Book Image

Mastering Laravel

By : Christopher Pecoraro
Book Image

Mastering Laravel

By: Christopher Pecoraro

Overview of this book

<p>PHP continues to revive and Laravel is at its forefront. Laravel follows modern PHP's object-oriented best practices and reduces time-to-market, enabling you to build robust web and API-driven mobile applications that can be automatically tested and deployed.</p> <p>With this book you will learn how to rapidly develop software applications using the Laravel 5 PHP framework.</p> <p>This book walks you through the creation of an application, starting with behavior-driven design of entities. You'll explore various aspects of modern software including the RESTful API, and will be introduced to command bus. Laravel's annotations package is also explained and demonstrated. Finally, the book closes with a demonstration of different ways to deploy and scale your applications.</p>
Table of Contents (17 chapters)
Mastering Laravel
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
3
Building Services, Commands, and Events
Index

From schema to migration


A common situation that occurs during the development process is that a schema is created, and then, we need to create a migration from that schema. At the time of writing, there is no official tool to do this in the Laravel core, but there are several packages available.

One such package is the migrations-generator package.

First, add the following line to the require-dev section of the composer.json file to require the migrations-generator dependency in the composer.json file:

"require-dev": {
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1",
    "xethron/migrations-generator": "dev-feature/laravel-five-stable",
    "way/generators": "dev-feature/laravel-five-stable"
  },

It is also necessary to add the following text to the composer.json file at the root level:

"repositories": [
  {
    "type": "git",
    "url": "[email protected]:jamisonvalenta/Laravel-4-Generators.git"
  }],

Composer's require-dev command

The require-dev command, as opposed to require, is...