TheDragonCode / pretty-routes

Pretty routes for Laravel Framework
MIT License
96 stars 7 forks source link

How to use it with Laravel 11? #74

Closed uwla closed 14 minutes ago

uwla commented 1 day ago

Description:

The instructions provided by the README:

In your bootstrap/app.php file add a line above $app->register(App\Providers\RouteServiceProvider::class):

if (env('APP_ENV') !== 'production') {
    $app->register(\PrettyRoutes\ServiceProvider::class);
    $app->configure('pretty-routes');
}

Do not apply to Laravel 11 because $app is not defined and it is not possible to call app().

Steps To Reproduce:

Launch Laravel 11 project and install this package.

By the way, thanks for the project!

andrey-helldar commented 1 day ago
  1. composer require dragon-code/pretty-routes --dev
  2. Start the php artisan serve or nginx or Laravel Sail
  3. Open the http://127.0.0.1:8000/routes page (or your domain name from the APP_URL parameter)

PS: The package has not been tested for PHP 8.4. I am waiting for the official release.

uwla commented 1 day ago

Hi @andrey-helldar , thanks for the response.

I just realized that when I attempt to install it, the routes were not loaded because the installation failed.

When I run:

composer require dragon-code/pretty-routes --dev

This is the output.

./composer.json has been updated
Running composer update dragon-code/pretty-routes
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires dragon-code/pretty-routes * -> satisfiable by dragon-code/pretty-routes[v1.0.0, ..., v1.26.3, v2.0.0, ..., v2.3.2, v3.0.0, ..., 3.4.
    - dragon-code/pretty-routes[v1.0.0, ..., v1.0.1] require php 7.2 -> your php version (8.3.13) does not satisfy that requirement.
    - dragon-code/pretty-routes[v1.0.2, ..., v1.20.0] require php ^7.2 -> your php version (8.3.13) does not satisfy that requirement.
    - dragon-code/pretty-routes[v1.21.1, ..., v1.26.3, v2.0.0, ..., v2.3.2] require illuminate/contracts ^5.0|^6.0|^7.0|^8.0 -> found illuminate/contracts[v5.0.0, ...
    - dragon-code/pretty-routes v3.0.0 requires illuminate/contracts ^6.0|^7.0|^8.0 -> found illuminate/contracts[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0,
    - dragon-code/pretty-routes[v3.1.0, ..., v3.2.2] require illuminate/contracts ^6.0 || ^7.0 || ^8.0 || ^9.0 -> found illuminate/contracts[v6.0.0, ..., v6.20.44, v7
    - dragon-code/pretty-routes v3.3.0 requires illuminate/contracts >=6.0 <11.0 -> found illuminate/contracts[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..
    - dragon-code/pretty-routes 3.4.0 requires dragon-code/support ^5.6 || ^6.1 -> satisfiable by dragon-code/support[v5.6.1, ..., v5.8.1, v6.1.0, ..., 6.15.0].
    - dragon-code/support[v5.6.1, ..., v5.8.1] require psr/http-message ^1.0.1 -> found psr/http-message[1.0.1, 1.1] but the package is fixed to 2.0 (lock file versio
    - dragon-code/support[v6.1.0, ..., 6.15.0] require ext-bcmath * -> it is missing from your system. Install or enable PHP's bcmath extension.

      Alternatively you can require one of these packages that provide the extension (or parts of it):
      - phpseclib/bcmath_compat PHP 5.x-8.x polyfill for bcmath extension
      - lumisys/bcmath_compat PHP 5.x/7.x polyfill for bcmath extension

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-bcmath` to temporarily ignore these required extensions.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require dragon-code/pretty-routes:*" to figure out if any version is 

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

The first items indicate that it will work only with PHP 7.2, but Laravel 11 requires PHP ^8.2.

andrey-helldar commented 20 hours ago

It's simple:

dragon-code/pretty-routes 3.4.0 requires dragon-code/support ^5.6 || ^6.1
dragon-code/support[v6.1.0, ..., 6.15.0] require ext-bcmath * -> it is missing from your system. Install or enable PHP's bcmath extension.

You must either install it, or run a command with the option to ignore it:

sudo apt install php8.4-bcmath

or

composer require dragon-code/pretty-routes --dev --ignore-platform-req=ext-bcmath

So Composer tries to find previous versions, and they require PHP 7.2. These are very old versions.

uwla commented 14 minutes ago

Thank you ! The package rocks