Skip to content

Jagepard/Rudra-Exception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

182 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPunit Maintainability CodeFactor Coverage Status

Rudra-Exception | API

Install

composer require rudra/exception

Usage

Throwing HTTP Errors
// Using abort() helper
abort(404);
abort(500, "Internal Server Error");

// Or directly
throw new RouterException("Not Found", 404);
throw new NotFoundException("Resource not found");
throw new LogicException("Invalid configuration");

Exception Hierarchy

Throwable
└── RuntimeException
    └── RudraException
        ├── RouterException
        ├── LogicException
        │   └── MiddlewareException
        ├── NotFoundException
        └── RuntimeException

Configuration

Error Pages

Configure error handlers in your setting.{$env}.yml:

http.errors:
    404:
        controller: App\Ship\Errors\Controller\HttpErrorsController 
        action: error404
    503:
        controller: App\Ship\Errors\Controller\HttpErrorsController
        action: error503

DebugBar Integration

In development mode, exceptions are automatically logged to DebugBar:

if (Rudra::config()->get("environment") === "development") {
    $debugbar->addCollector(new DebugBar\DataCollector\ExceptionsCollector());
}

License

This project is licensed under the Mozilla Public License 2.0 (MPL-2.0) — a free, open-source license that:

  • Requires preservation of copyright and license notices,
  • Allows commercial and non-commercial use,
  • Requires that any modifications to the original files remain open under MPL-2.0,
  • Permits combining with proprietary code in larger works.

📄 Full license text: LICENSE
🌐 Official MPL-2.0 page: https://mozilla.org/MPL/2.0/

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages