PHP code example of samuel-nunes / laravel-ddd-toolkit

1. Go to this page and download the library: Download samuel-nunes/laravel-ddd-toolkit 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/ */

    

samuel-nunes / laravel-ddd-toolkit example snippets




namespace App\Modules\Order\Application\Ports\Out;

interface OrderRepository
{
}



namespace App\Modules\Order\Infrastructure\Persistence\Adapters;

use App\Modules\Order\Application\Ports\Out\OrderRepository;

final class EloquentOrderRepository implements OrderRepository
{
}

$this->app->bind(
    \App\Modules\Order\Application\Ports\Out\OrderRepository::class,
    \App\Modules\Order\Infrastructure\Persistence\Adapters\EloquentOrderRepository::class,
);

return [
    'default_preset' => 'hexagonal',
    'modules_path' => 'app/Modules',
    'shared_path' => 'app/Shared',
    'create_repositories' => false,
    'create_policies' => false,
    'create_jobs' => true,
    'create_events' => true,
];

'create_repositories' => false,
text
app/Modules
app/Shared
app/Providers/ModulesServiceProvider.php
config/ddd.php
AGENTS.md
text
bootstrap/providers.php
bash
php artisan ddd:install
bash
php artisan ddd:install --merge-agents
bash
php artisan ddd:install --no-agents
bash
php artisan ddd:install --force-agents
bash
php artisan make:module Order
php artisan make:port Order OrderRepository --type=out
php artisan make:adapter Order EloquentOrderRepository --port=OrderRepository --type=persistence
php artisan make:usecase Order CancelOrder
bash
php artisan ddd:check --module=Order
bash
php artisan make:module Billing
bash
php artisan make:module Billing --context-file=docs/billing-context.md
bash
php artisan make:module Order
bash
php artisan make:entity Order Order
php artisan make:value-object Customer Email
php artisan make:event Order OrderCancelled
php artisan make:usecase Order CancelOrder
bash
php artisan make:port Order OrderRepository --type=out
php artisan make:port Order CancelOrderUseCase --type=in
php artisan make:adapter Order EloquentOrderRepository --port=OrderRepository --type=persistence
bash
php artisan make:integration Payment Stripe
bash
php artisan ddd:check
php artisan ddd:cache
php artisan ddd:clear
bash
php artisan make:module Order
text
app/Modules/{Module}/Infrastructure/Http/routes.php
text
app/Modules/{Module}/Infrastructure/Providers/*ServiceProvider.php
bash
php artisan ddd:cache
text
bootstrap/cache/ddd-modules.php
bash
php artisan ddd:clear
bash
php artisan ddd:check
bash
php artisan ddd:check --module=Order
text
config/ddd.php
bash
php artisan make:repository Order OrderRepository --force
bash
php artisan make:port Order OrderRepository --type=out
php artisan make:adapter Order EloquentOrderRepository --port=OrderRepository --type=persistence
bash
php artisan vendor:publish --tag=ddd-stubs
text
stubs/vendor/laravel-ddd-toolkit
bash
composer analyse