2017 © Pedro Peláez
 

library laravel4-namespace-migrator

Package for Laravel 4, supporting using namespaces in migration classes

image

ed-fruty/laravel4-namespace-migrator

Package for Laravel 4, supporting using namespaces in migration classes

  • Wednesday, December 3, 2014
  • by ed-fruty
  • Repository
  • 1 Watchers
  • 2 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

laravel4-namespace-migrator

Laravel 4 is not support namespaces in migration classes, but it is not a problem ;), (*1)

Installation

  1. Use Composer to install package into your project:, (*2)

    ```bash composer require "ed-fruty/laravel4-namespace-migrator": "1.0.0", (*3)

2. Add the service provider in `app/config/app.php`:

  ```bash
  'Fruty\LaravelNamespaceMigrator\LaravelNamespaceMigratorServiceProvider',
  1. Publish package configuration, (*4)

    ```bash php artisan config:publish ed-fruty/laravel4-namespace-migrator, (*5)




#Usage

Default migration namespaces searching

When you call migrations like ```bash php artisan migrate --path=app/Modules/Blog/Migrations

Migrator automatically searches classes with namespace App\Modules\Blog\Migrations in app/Modules/Blog/Migrations To change default values, edit configuration file app/config/packages/ed-fruty/laravel4-namespace-migrator/main.php block default, (*6)

Reserving namespaces for migration paths

For reserving namespace for some path, edit configuration file app/config/packages/ed-fruty/laravel4-namespace-migrator/main.php. Example:, (*7)

'reserved' => [
      base_path('app/modules/Blog/migrations') => 'Blog\\Migrations\\',
  ]

It means, when you call migrations like:, (*8)

php artisan migrate --path=app/modules/Blog/migrations

Migrator automatically searches classes with namespace Blog\Migrations in that directory., (*9)

Workbenches

For workbench packages Migrator automatically searches migrations by vendor/package name. When you call migrations like:, (*10)

php artisan migrate --bench=foo/bar

Migrator searches classes with namespace Foo\Bar\Migrations in workbench/foo/bar/src/migrations So if workbench namespace does not equal to vendor/package name you must register it in 'reserved' block like:, (*11)

base_path('workbench/foo/bar/src/migrations') => 'VendorNamespace\\PackageNamespace\\'

Without namespaces

Migrator always searches classes with namespace firstly and if class not found with namespace it trying to search class without namespace. For example basic usage:, (*12)

php artisan migrate, (*13)

By default configs, Migrator firstly searches migration classes with namespace App\database\migrations in app/database/migrations and if it does not exists, Migrator tries to load class without namespace from that catalog., (*14)

The Versions

03/12 2014

dev-master

9999999-dev

Package for Laravel 4, supporting using namespaces in migration classes

  Sources   Download

MIT

The Requires

 

by Avatar Eduard

laravel php migration namespace migrator

03/12 2014

v1.0.0

1.0.0.0

Package for Laravel 4, supporting using namespaces in migration classes

  Sources   Download

MIT

The Requires

 

by Avatar Eduard

laravel php migration namespace migrator