chevere/throwable-handler

Throwable handler for multiple contexts

1.0.3 2024-11-06 20:01 UTC

README

Chevere

Build Code size Apache-2.0 PHPStan Mutation testing badge

Quality Gate Status Maintainability Rating Reliability Rating Security Rating Coverage Technical Debt CodeFactor

ThrowableHandler

Quick start

Install ThrowableHandler using Composer.

composer require chevere/throwable-handler

Register ThrowableHandler to handle all errors.

use Chevere\ThrowableHandler\ThrowableHandler;

set_error_handler(ThrowableHandler::ERROR_AS_EXCEPTION);
register_shutdown_function(ThrowableHandler::SHUTDOWN_ERROR_AS_EXCEPTION);

Register your exception handler, you can choose:

  • ThrowableHandler::PLAIN
  • ThrowableHandler::CONSOLE
  • ThrowableHandler::HTML
use Chevere\ThrowableHandler\ThrowableHandler;

set_exception_handler(ThrowableHandler::PLAIN);

Demo

HTML demo

Documentation

Documentation is available at chevere.org.

License

Copyright 2024 Rodolfo Berrios A.

Chevere is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.