PHP code example of eightyfive / laravel-autoroute
1. Go to this page and download the library: Download eightyfive/laravel-autoroute library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eightyfive / laravel-autoroute example snippets
// app/Providers/RouteServiceProvider.php
use Eyf\Autoroute\Autoroute;
class RouteServiceProvider extends ServiceProvider
{
public function map(Autoroute $autoroute)
{
$autoroute->load(["api.yaml"]);
}
}
// app/Providers/RouteServiceProvider.php
use Eyf\Autoroute\Autoroute;
class RouteServiceProvider extends ServiceProvider
{
public function map(Autoroute $autoroute)
{
$parameters = [
"app_domain" => env("APP_DOMAIN", "example.org"),
];
$autoroute->load(["api.yaml"], $parameters);
}
}
// app/Providers/AppServiceProvider.php
use Eyf\Autoroute\RouteNamerInterface;
use App\Services\MyRouteNamer;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind(RouteNamerInterface::class, MyRouteNamer::class);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.