PHP code example of ngarak-dev / laravel-modularization

1. Go to this page and download the library: Download ngarak-dev/laravel-modularization library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ngarak-dev / laravel-modularization example snippets


public function store(StoreProductRequest $request): RedirectResponse
{
    $this->service->create($request->validated());

    return redirect()->route('product.index');
}

module_path('Catalog');
module_path('Catalog', 'Http/Controllers');
modules_path();

use NgarakDev\Modularization\Facades\Modularization;

Modularization::hasModule('Catalog');
Modularization::isEnabled('Catalog');
Modularization::enable('Catalog');
Modularization::getModules();
bash
php artisan module:make Billing
php artisan module:list
bash
php artisan module:make Catalog --api --with-views --resource=Product
php artisan module:make Inventory --with-livewire
php artisan module:make Invoices --

modules/Billing/
├── module.json                 # machine-readable contract
├── Config/config.php           # optional extra config
├── Database/Migrations/
├── Http/Controllers/
├── Models/
├── Providers/BillingServiceProvider.php
├── Repositories/
├── Routes/web.php
├── Resources/views/
└── Services/
bash
php artisan module:make-livewire Catalog ProductCard
bash
php artisan module:make-event Catalog ProductCreated --listener=NotifyTeam
php artisan module:make-translation Catalog --languages=en,fr
php artisan module:make-auth Auth
php artisan module:make-manager
bash
php artisan module:export Catalog --vendor=Acme --author="Jane Doe" [email protected]