Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Paginateroute

Laravel Paginateroute Laravel Package

michaloravec/laravel-paginateroute

Adds a paginate route macro to Laravel for pagination via custom routes instead of query strings, with translatable "page" segments, normal/dash/simple URL modes, config publishing, and its own URL helpers.

View on GitHub
Deep Wiki
Context7

Laravel outer extension to easily use laravel's paginator without the query string.

Frequently asked questions about Laravel Paginateroute
How do I install and register michaloravec/laravel-paginateroute in Laravel?
Run composer require michaloravec/laravel-paginateroute; the package auto-registers its service provider. Add use PaginateRoute; to app/Providers/RouteServiceProvider.php and call PaginateRoute::registerMacros() inside boot() before parent::boot(). Optionally publish the config file with php artisan vendor:publish --provider=MichalOravec\PaginateRoute\PaginateRouteServiceProvider --tag=config. After that, define listing routes with Route::paginate instead of Route::get.
How do I replace query-string pagination with URLs like /news/page/2?
Define the listing route with Route::paginate('news', 'NewsController@index') instead of Route::get. The macro registers both /news and /news/page/{page} for you. Keep using Laravel's normal paginate() or simplePaginate() methods in the controller. Replace the default pagination markup in Blade with the package's URL helpers so links point to the path-based pages.
How do I customize pagination URL modes and translate the page segment?
Set the mode value in config/paginateroute.php to normal, dash, or simple. Normal gives /news/page/2, dash gives /news/page-2, and simple gives /news/2. Publish the language files with the vendor:publish command using the lang tag, then add translations for the page segment. Test localized route groups to confirm each locale generates the correct translated segment.
How do I generate pagination links in Blade with PaginateRoute?
Laravel's default paginator links still use query strings, so the package provides its own URL helpers. Use PaginateRoute::previousPageUrl(), PaginateRoute::nextPageUrl(), and the related page helpers to build your pagination markup. Replace the standard links() output with these helpers. Verify the generated URLs match your configured mode and locale.
Does laravel-paginateroute work with Laravel route caching?
Macro registration happens at runtime, so route caching must be tested rather than assumed. Register PaginateRoute::registerMacros() in RouteServiceProvider::boot() before parent::boot(), then run php artisan route:cache in your deploy pipeline. Confirm each paginated route still expands to the expected base and page routes after caching. If registration order causes problems, adjust the boot sequence and re-test.
Which Laravel versions does michaloravec/laravel-paginateroute support?
The 2024 release suggests recent Laravel support, but the README does not publish a full compatibility matrix. Check the repository composer.json constraints and release history for the exact tested range. Run a pilot route on your target Laravel major and minor in CI before adopting it broadly. Do not assume compatibility with every supported Laravel version.
What happens on an out-of-range page such as /news/page/999?
The package is a thin adapter over Laravel's paginator, so behavior depends on how the paginator handles the requested page. Laravel commonly returns an empty result set rather than a 404 unless you add explicit handling. Decide whether your product needs a 404, an empty list, or a redirect to the last valid page. Enforce that behavior in the controller or middleware and test it.
How do I avoid duplicate content between ?page=2 and /news/page/2?
Path-based pagination can coexist with Laravel's query-string pagination if you do not handle it deliberately. Choose one canonical URL shape, emit correct canonical and rel=prev/next tags, and decide whether legacy ?page=N URLs should redirect. A 301 redirect from query-string URLs to path-based URLs is a common SEO continuity approach. Test canonical output and redirect behavior before launch.
Can I use laravel-paginateroute for API pagination?
No, it is designed for server-rendered Laravel pages where path-based pagination is a product or SEO requirement. APIs should generally use query-string pagination or cursor-based pagination with stable JSON responses. For API-first surfaces, Laravel's native ?page=N with withQueryString() is simpler and adds no dependency. Use this package only where clean listing URLs matter.
Is michaloravec/laravel-paginateroute safe for production and what are the alternatives?
The codebase is small and auditable, so the worst case is usually broken pagination links on a listing page rather than a data-layer failure. The main risk is organizational: it has a single maintainer, few stars, and no dependents, so pin the exact version and pilot one low-risk route. The closest alternative is spatie/laravel-paginateroute, which inspired this package; do not install both because their macros can collide. Define a fork trigger for future Laravel upgrades before standardizing.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log