konekt/concord
Laravel extension for building modular applications using conventions on top of service providers. Manage in-app and external modules with isolation-friendly structure, version compatibility across Laravel releases, and tooling around module registration and organization.
Create the module folder app/Modules/Demo
Create the file app/Modules/Demo/Providers/ModuleServiceProvider.php:
namespace App\Modules\Demo\Providers;
use Konekt\Concord\AbstractModuleServiceProvider;
class ModuleServiceProvider extends AbstractModuleServiceProvider
{
}
Create app/Modules/Demo/resources/manifest.php:
<?php
return [
'name' => 'Demo App Module',
'version' => '1.3.9'
];
Add the module to config/concord.php:
<?php
return [
'modules' => [
App\Modules\Demo\Providers\ModuleServiceProvider::class,
]
];
Now if you run the php artisan concord:modules command it shows the newly added module:
+----+------------------+--------+---------+------+-------------------+
| # | Name | Kind | Version | Id | Namespace |
+----+------------------+--------+---------+------+-------------------+
| 1. | Demo App Module | Module | 1.3.9 | demo | App\Modules\Demo |
+----+------------------+--------+---------+------+-------------------+
Init a git repo in an empty folder: git init .
Add composer.json:
{
"name": "vendor/mymodule",
"description": "My Module Rulez",
"type": "library",
"require": {
"php": "^7.2",
"konekt/concord": "^1.5"
},
"autoload": {
"psr-4": { "Vendor\\MyModule\\": "src/" }
}
}
Create the file src/Providers/ModuleServiceProvider.php:
namespace Vendor\MyModule\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
}
Create src/resources/manifest.php:
<?php
return [
'name' => 'My Module',
'version' => '1.0.0'
];
Commit all the stuff, and publish it (github and packagist if it's open source)
In the host application: composer require vendor/mymodule
Add the module to config/concord.php:
<?php
return [
'modules' => [
Vendor\MyModule\Providers\ModuleServiceProvider::class,
]
];
You're done.
Next: Boxes Explained »
How can I help you explore Laravel packages today?