Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Progressive loading with Laravel's pagination

Can Laravel's pagination be modified to create progressive loading:

https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Loading

I was thinking to combine Laravel's pagination with JS as seen in the MDN article above.

So for example trigger the page changes (page number) that the pagination creates when reaching the end of viewport

But before I start trying to implement that I wanted to ask if you think that's even a good idea to do that or there are some things that would make it impossible or harder than to implement it from scratch

0 likes
5 replies
Ben Taylor's avatar

You mean like infinite scroll? Yep, you could easily use laravel's pagination to do that. You could use the intersection observer to trigger an axios request to get the next page of items, then append them to the end of the list.

1 like
Ligonsker's avatar

@Ben Taylor thanks! Yes, infinite scroll. What is the intersection observer by the way?

Ben Taylor's avatar

@Ligonsker the intersection observer is mentioned in the article you linked to. It is a Javascript api in the browser to detect where you are on a page

1 like
Ligonsker's avatar

@Ben Taylor Haha oh no! I actually did not read the article fully and linked it as the example of "Progressive loading", because I remembered it had a different name which is more familiar but I forgot it and you just mentioned it (infinite scroll). I guess it's time to actually read the article now :D

Please or to participate in this conversation.