Download the PHP package sendy/modularizer without Composer
On this page you can find all versions of the php package sendy/modularizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package modularizer
Laravel 4 Modularizer
https://github.com/sendyhalim/laravel-modularizer
This package is still in early development, but it is usable and already tested.
Modularizer is a Laravel 4 plugin. Basically it is an artisan command that creates module and auto validation repository based on given input. It is inspired by these amazing people:
Install
Add "sendy/modularizer": "dev-master" to your composer.json then run composer update in your terminal.
Add Sendy\Modularizer\ModularizerCommandServiceProvider and Sendy\Modularizer\ModularizerModulesServiceProvider respectively to app/config/app.php service providers.
Sendy\Modularizer\ModularizerCommandServiceProvideris for registering commands.Sendy\Modularizer\ModularizerModulesServiceProvideris for registering active modules(registers route and view namespace of module).
Last, (with default config)include this to your composer.json for autoloading
Using it...
First make you need to publish the config, fire up your terminal and type
it will generate modularizer config app/config/packages/sendy/modularizer/module.php
inside the config, there's
base_pathis the path where your module will be created.base_directoryis the base directory inside base path, by default it will make module inapp/modules/Modules. With this, it's easy to include composer autoloading namespace by usingModulesas base namespace.activeis an array of active modules, think of it as module registration.
Available Commands
Create a module:
arguments
- Module name
options
--pathbase path to modules to be created, default toapp/modules.--basedirectorybase directory of modules, default toModules, with default config modules will be created inapp/modules/Modulesand base namespace will beModules.
Prepare modularizer, make Core for your modules
options
--pathbase path to modules to be created, default toapp/modules.--basedirectorybase directory of modules, default toModules, with default configCorewill be created inapp/modules/Modulesand base namespace will beModules.
Create repository
arguments
- Model name
- Module name
options
--pathbase path to modules to be created, default toapp/modules.--basedirectorybase directory of modules, default toModules, with default config modules will be created inapp/modules/Modulesand base namespace will beModules.--basenamespacebase namespace, defaultModules.
Create migration for a module
This command takes input and call php artisan migrate:make command with path edited to module path hence you need to specify your module name
arguments
- Migration name
- Module name
options
--pathpath for migration file, with default config it will beapp/modules/ModuleName/database/migrations.--basedirectorybase directory of modules, default toModules--createspecify this if the migration is to create new table.(Same as laravel migration option)--tablespecify this if the migration is to modify new table.(Same as laravel migration option)
Examples
Creating Admin module
with default config it will create Admin module in app/modules/Modules
Admin views is registered with its namespace admin::view-file, example I have a view file Admin/views/layout.blade.php, to get it you need to use admin::layout
Modularizer also comes with autovalidation repository, first you need to publish Core(I like to call it so, but you can configure whatever name you like)
with default config it will create Core in app/modules/Modules
All repositories and interfaces that are created by modularizer will automatically extend BasicRepository(Reader/Writer) and its interface will automatically extend BasicRepository(Reader/Writer)Interfaces
Notice ValidatorInterface.php, everytime we save(create/update) with a repository, we need to pass a class that implements ValidatorInterface to the repository. First let's make a validator for model User
Now we need a UserRepository, with modularizer we can make it fast
the above command will make repository(read and write) for model User inside Admin module. 4 Files will be created for you
Admin/RepositoryInterfaces/Read/UserRepositoryReaderInterfaceAdmin/RepositoryInterfaces/Write/UserRepositoryWriterInterfaceAdmin/Repositories/Read/UserRepositoryReaderAdmin/Repositories/Write/UserRepositoryWriter
The repository interfaces will be tied with user repositories
That's it! We can use the UserRepository now