Download the PHP package nikolawd/laravel-route-disabling without Composer

On this page you can find all versions of the php package nikolawd/laravel-route-disabling. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-route-disabling

Laravel Route Disabling

Latest Version on Packagist Total Downloads

Temporarily disable Laravel routes without removing them from the codebase. Perfect for maintenance mode, feature flags, A/B testing, and gradual rollouts.

The implementation follows Laravel's internal patterns for route handling and has been thoroughly tested to work with route caching.

Installation

You can install the package via Composer:

The package will automatically register its service provider.

Usage

Basic Usage - Default Message

Custom Message

The package uses Laravel's native error handling system (abort(503, $message)), which means:

Custom Response with Callback

Conditional Disabling

Dynamic Enabling/Disabling

Return null or false from a callback to allow the route to proceed normally:

Use Cases

1. Selective Maintenance Mode

Disable specific routes without putting the entire application in maintenance mode:

2. Feature Flags

Easily toggle features on/off based on configuration or environment:

3. Time-Based Availability

Enable routes only during specific time periods:

4. Business Hours

Restrict access to certain routes during business hours:

5. Gradual Rollouts

Enable features for a percentage of users:

6. Emergency Response

Quickly disable problematic endpoints in production:

Route Caching Support

This package fully supports Laravel's route caching (php artisan route:cache). Closures are automatically serialized and deserialized using Laravel's SerializableClosure, following the same pattern as Laravel's core routing system.

Testing

Customizing the 503 Error Page

Since the package uses Laravel's native error handling, you can customize the 503 error page just like any other Laravel error page:

  1. Create resources/views/errors/503.blade.php in your application
  2. Use $exception->getMessage() to display your custom message

Example custom error page:

Laravel will automatically use your custom view instead of the default error page.

How It Works

The package uses Laravel's macro system to add disabled() and getDisabled() methods to the Route class with full type hinting support. When a route is disabled:

  1. The disabled status/message/callback is stored in the route action array
  2. A middleware is automatically registered to the route
  3. The middleware checks if the route is disabled
  4. For simple messages, it calls abort(503, $message) which triggers Laravel's error handling
  5. If a callback is provided, it's executed and the response is returned
  6. If the callback returns null or false, the request proceeds normally

For route caching:

Type Hints

All methods include proper PHP 8.2+ type hints:

License

The MIT License (MIT). Please see License File for more information.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

Please see CHANGELOG.md for more information on what has changed recently.


All versions of laravel-route-disabling with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/routing Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
laravel/serializable-closure Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nikolawd/laravel-route-disabling contains the following files

Loading the files please wait ...