PHPackages                             mhmdasli/kyzin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. mhmdasli/kyzin

ActiveLibrary[Framework](/categories/framework)

mhmdasli/kyzin
==============

Laravel Modular pattern, with cli generator and other tools

016JavaScript

Since May 7Pushed 7y agoCompare

[ Source](https://github.com/mhmdasli/kyzin)[ Packagist](https://packagist.org/packages/mhmdasli/kyzin)[ RSS](/packages/mhmdasli-kyzin/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Kyzin Core
==========

[](#kyzin-core)

This package gives you the ability to use Laravel 5 with module system. You can simply drop or generate modules with their own commands, components, controllers, models, providers, views, helpers, translations and a routes file into the `app/Modules` folder and go on working with them.

Documentation
-------------

[](#documentation)

- [Installation](#installation)
- [Getting started](#getting-started)
- [Usage](#usage)

Installation
------------

[](#installation)

The best way to install this package is through your terminal via Composer.

Run the following command from your projects root

```
composer require mhmdasli/kyzin:dev-master

```

Once this operation is complete, simply add the service provider to your project's `config/app.php` and you're done.

#### Service Provider

[](#service-provider)

```
MhmdAsli\Kyzin\KyzinServiceProvider::class,

```

Getting started
---------------

[](#getting-started)

The built in Artisan command `php artisan kyzin:core name [--no-migration] [--no-translation]` generates a ready to use module in the `app/Modules` folder and a migration if necessary.

This is how the generated module would look like:

```
laravel-project/
    app/
    └── Modules/
        └── FooBar/
            ├── Commands/
            │   └── FooBarCommand.php
            ├── Components/
            │   └── FooBarComponent.php
            ├── Controllers/
            │   └── FooBarController.php
            ├── Models/
            │   └── FooBar.php
            ├── Providers/
            │   └── Provider.php
            ├── Views/
            │   └── index.blade.php
            ├── Translations/
            │   └── en/
            │       └── example.php
            ├── routes
            │   ├── api.php
            │   └── web.php
            └── helper.php
                

```

Usage
-----

[](#usage)

The generated `RESTful Resource Controller` and the corresponding `routes.php` make it easy to dive in. In my example you would see the output from the `Modules/FooBar/Views/index.blade.php` when you open `laravel-project:8000/foo-bar` in your browser.

#### Disable modules

[](#disable-modules)

In case you want to disable one ore more modules, you can add a `modules.php` into your projects `app/config` folder. This file should return an array with the module names that should be **loaded**. F.a:

```
return [
    'enable' => array(
        "customer",
        "contract",
        "reporting",
    ),
];

```

In this case Kyzin would only load this three modules `customer` `contract` `reporting`. Every other module in the `app/Modules` folder would not be loaded.

Kyzin will load all modules if there is no modules.php file in the config folder.

#### Use a single `routes.php` file

[](#use-a-single-routesphp-file)

Instead of using a single routes file there is a routes folder with the route files `web.php` and `api.php`. No panic, the old fashioned routes file will be loaded anyways. So if you like it that way you can stick with the single routes file in the module-root folder.

#### Load additional classes

[](#load-additional-classes)

In some cases there is a need to load different additional classes into a module. Since Laravel loads the app using the PSR-4 autoloading standard, you can just add folders and files almost without limitations. The only thing you should keep in mind is to add the correct namespace.

F.a. If you want to add the `App/Modules/FooBar/Services/FancyService.php` to your module, you can absolutely do so. The file could then look like this:

```
