PHP code example of hexaora / api-crud-generator

1. Go to this page and download the library: Download hexaora/api-crud-generator 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/ */

    

hexaora / api-crud-generator example snippets


// config/hexaora.php
'policies' => [
    'spatie' => true,  // Enable Spatie permissions
],

public function register()
{
    $this->app->bind(
        \App\Modules\YourModule\Domain\Repositories\YourEntityRepositoryInterface::class,
        \App\Modules\YourModule\Infrastructure\Repositories\YourEntityRepository::class
    );
}

// Include module routes

// Include versioned module routes

// config/hexaora.php

return [
    'module_namespace' => 'App\\Modules',
    
    'pagination' => [
        'per_page' => 15,
    ],
    
    'policies' => [
        'spatie' => false,           // Enable Spatie permission integration
        'namespace' => 'App\\Modules\\{module}\\Domain\\Policies',
        'auto_register' => true,     // Auto-register in AuthServiceProvider
    ],
    
    'factories' => [
        'count' => 10,               // Default factory count in seeders
        'namespace' => 'App\\Modules\\{module}\\Database\\Factories',
    ],
    
    'seeders' => [
        'namespace' => 'App\\Modules\\{module}\\Database\\Seeders',
    ],
];
bash
# Publish stubs 
php artisan vendor:publish --tag="hexaora-stubs"

# Publish config 
php artisan vendor:publish --tag="hexaora-config"
bash
php artisan migrate
bash
php artisan db:seed --class=ApiSeeder
bash
php artisan vendor:publish --tag="hexaora-config"