Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

A Laravel package to easily add paginated routes

Laravel offers a nice way to add pagination. As far as your routes are concerned you don’t have to do a thing. It just works out of the box.  Unfortunately the generated url’s are pretty ugly:


What we want are url’s that look like this:


And ideally the pagination string in the url should be translatable. For example:


At Spatie we made a package that can generate these beautiful url’s.  Sebastian did a terrific job coding it up. The package provides a paginate route macro and some handy functions to generate urls to the previous and next page. Check it out on GitHub if you want to learn more about it:



Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.