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

Pagerfanta Laravel Package

lyssal/pagerfanta

Lyssal Pagerfanta is a lightweight PHP package that simplifies pagination with Pagerfanta. It offers convenient helpers and adapters for paging query results and collections, letting you build pageable lists, search results, and consistent navigation links with minimal setup and flexible page sizes.

View on GitHub
Deep Wiki
Context7

Extensions for the Pagerfanta library.

Frequently asked questions about Pagerfanta
How do I install lyssal/pagerfanta with Composer?
Install it with Composer by running composer require lyssal/pagerfanta in your project. Composer will resolve Pagerfanta and any required dependencies. After installation, create Pagerfanta instances using the adapter that matches your data source. Check your composer.json constraints to ensure the package version matches your PHP version.
Is lyssal/pagerfanta compatible with Laravel?
It is a PHP package installable via Composer, so it can be used inside a Laravel application. The provided overview does not mention a Laravel service provider, facade, config file, or Blade helpers, so expect to wire Pagerfanta manually in controllers and pass the pager to your views. If you need native Laravel pagination features such as Blade pagination links and Eloquent integration, Laravel's built-in paginator may be a closer fit.
Can I paginate arrays and Doctrine collections with lyssal/pagerfanta?
Yes. The package is described as working with Doctrine collections and plain arrays through Pagerfanta adapters. You choose the adapter for your data source, wrap it in a Pagerfanta instance, and then read the current page results. This lets you paginate database-backed collections and in-memory arrays with a consistent API.
How do I set the number of items per page with Pagerfanta?
Page size is controlled on the Pagerfanta pager instance, typically with setMaxPerPage before you read the current page. The package overview highlights configurable page sizes and paginated result sets as a feature. Set the value once per request based on your UI or query string, then call getCurrentPageResults.
Which Pagerfanta adapters can I use with this package?
The provided overview specifically names Doctrine collections and plain arrays, which map to Pagerfanta's array and Doctrine collection adapter usage. For other data sources, you would use the corresponding Pagerfanta adapter if one is available in your installed dependencies. The package is presented as a thin integration layer, so adapter choice remains a Pagerfanta concern.
How do I render pagination links with Pagerfanta view renderers?
The package is described as compatible with Pagerfanta view renderers, so you can use Pagerfanta's view classes to generate navigation HTML. In a Laravel or plain PHP template, render the view with the pager and output the resulting links. Keep rendering separate from pagination logic so you can swap view styles without changing controllers.
Do I need Symfony to use lyssal/pagerfanta?
No. The overview presents it as a lightweight PHP integration for Lyssal projects, and Symfony is not listed as a requirement. You can use it in plain PHP or inside a framework such as Laravel by installing it with Composer. Framework-specific integration details are not documented in the provided context, so plan to wire it manually.
How should I test pagination built with lyssal/pagerfanta?
Because the package returns Pagerfanta pager objects, you can unit test pagination behavior with PHPUnit. Build a pager over a known array, set the current page and max per page, then assert the current page results and page count. The provided docs do not mention Laravel-specific testing helpers, so test the pager directly rather than relying on framework assertions.
Is lyssal/pagerfanta actively maintained and safe for production?
The provided context does not include release history or maintenance guarantees. Check the GitHub repository and Packagist for recent commits, tagged releases, and open issues before adopting it. For production, pin a tested version in composer.json and review changes before upgrading. If long-term support is critical, weigh the risk of relying on a small integration package.
What are good alternatives to lyssal/pagerfanta?
Alternatives include using Pagerfanta directly, Laravel's built-in paginator for Eloquent and query builder results, or other Composer pagination packages. Choose based on whether you need Doctrine collection support, Pagerfanta view renderers, or tighter Laravel integration. lyssal/pagerfanta is most useful when you want a thin Pagerfanta wrapper for arrays and Doctrine collections.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource