PHP code example of abacus / module-builder

1. Go to this page and download the library: Download abacus/module-builder 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/ */

    

abacus / module-builder example snippets




use App\Providers\AppServiceProvider;
use App\Business\Car\CarServiceProvider;

return [
    AppServiceProvider::class,
    CarServiceProvider::class,
];




declare(strict_types=1);

namespace App\Communication\Car\Controllers;

use App\Business\Car\Data\CarData;
use App\Business\Car\Facades\CarFacade;
use App\Communication\Car\Requests\CarRequest;
use App\Http\Controllers\Controller; // <- Check this

class CarController extends Controller
{
    public function __construct(private readonly CarFacade $facade)
    {
    }

    public function store(CarRequest $request): int
    {
        return $this->facade->store(CarData::fromRequest($request));
    }

    public function update(int $id, CarRequest $request): int
    {
        return $this->facade->update($id, CarData::fromRequest($request));
    }

    public function delete(int $id): ?bool
    {
        return $this->facade->delete($id);
    }
}
bash
php artisan abacus:create:module Car