Download the PHP package dannypas00/laravel-dynamic-routes without Composer

On this page you can find all versions of the php package dannypas00/laravel-dynamic-routes. 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-dynamic-routes

Laravel dynamic routes

Laravel dynamic routes is a simple RouteServiceProvider that dynamically resolves routes from route files based on their placement within the filesystem. Route names and prefixes are dynamically allocated to the routes resolved by this provider, and middleware (groups) can be assigned on a directory level.

Installation

Implementation

Implementation is very simple; just change the default RouteServiceProvider import in your project's App\Providers\RouteServiceProvider from Illuminate\Foundation\Support\Providers\RouteServiceProvider to DannyPas00\LaravelDynamicRoutes\RouteServiceProvider:

Example

Say we have a directory structure like so:

In vanilla laravel, you would need to add code to the RouteServiceProvider to register each of these files individually. This made managing large projects cumbersome because you would either end up with a couple very big route files (such as web.php or api.php), or many small ones that all require a separate piece of code in the RouteServiceProvider, cluttering the provider instead. With dynamic routing however, all of these route files will be registered without any additional configuration needed. When this is done, the routes in the route file take on a path associated with the file location. E.g. the routes registered in the routes/api/rest/users.php file will all be registered as api/rest/users/{route}.

The full output of php artisan route:list would look something like this:

Since the dynamic route provider extends the laravel provider, all methods can still be overwritten, so long as the dynamic provider's boot() or routeRegistration() method is called.

Customizing

The following customization options are available within the route service provider:

Route directory

Setting the ROUTE_DIRECTORY const in the implementing service provider will change the default routes/ directory.

Root file

Setting the ROOT_FILE const in the implementing service provider will change which route files will be treated as " root" files.
Any root file in any directory will not reflect its name into its prefix or path (see root.php in example).

Flatten directories

Any directory added to the FLATTEN_DIRECTORIES array will be ignored when building paths and prefixes.
Set to just 'web' by default, any file in the routes/web directory will not have "web" in its route or prefix.

Middleware matching

For any directory-wide middleware matching (web and api split for example), the matchMiddleware function can be overwritten.
It accepts the route's directory as string, and expects a middleware string (or null when not middleware needs to be set) as a response.


All versions of laravel-dynamic-routes with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^10.0|^9.0
php Version ^8.2|^8.1|^8.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 dannypas00/laravel-dynamic-routes contains the following files

Loading the files please wait ....