PHP code example of slash-dw / error-kit

1. Go to this page and download the library: Download slash-dw/error-kit 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/ */

    

slash-dw / error-kit example snippets


use SlashDw\ErrorKit\Domain\AbstractStructuredDomainException;
use SlashDw\ErrorKit\Enums\ReportBehavior;

final class OrderCannotBeCancelled extends AbstractStructuredDomainException
{
    public function errorCode(): int { return 1001001; }
    public function errorSlug(): string { return 'order.cannot_cancel'; }
    public function developerMessage(): string { return 'Order already shipped.'; }
    public function userMessageKey(): string { return 'orders.cannot_cancel'; }
    public function reportBehavior(): ReportBehavior { return ReportBehavior::Warning; }
}