district5 / php-slim-framework-routes-builder
Read and generate a routing file based on the directories containing them.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/district5/php-slim-framework-routes-builder
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2025-10-13 19:19:09 UTC
README
Information
This library automatically creates the app/bootstrap.php
file for Slim Framework applications. This is controlled
in development and production by the $scanAndWrite
parameter.
If $scanAndWrite
parameter is true
this will rescan the routes directory (or directories) and generate the bootstrap
file automatically. If false
, the library will simply return the path to the bootstrap file.
Usage...
In your main public/index.php
or wherever you currently include your routes file, place this:
<?php define('BASE_DIR', realpath(__DIR__ . '/../')); $shouldRescan = true; // You could use a 'development' flag to establish this $routeFile = \District5\SlimRouteFileBuilder\RouteBuilder::scanRoutes( $shouldRescan, // Should the system rescan and write a new routes file? BASE_DIR, // The base directory to work with. '-route.php' // What the route file names should end in (optional). Use null to ignore this. ); /** @noinspection PhpIncludeInspection */ include $routeFile;