xetaio/xetaravel-counts
A Laravel package for adding countable relationships to Eloquent models. Track views, likes, or any custom counts on your records using simple traits and polymorphic relations, with helpers for incrementing, decrementing, and querying totals.
Check Laravel compatibility first. Version 3.0.0 is a Laravel 13 compatibility release. If the application is on Laravel 12 or older, stay on the 2.x line until the app is upgraded.
Install with Composer:
composer require xetaio/xetaravel-counts
Publish and run any package migrations/config if the package provides them:
php artisan vendor:publish --provider="Xetaio\Counts\CountsServiceProvider"
php artisan migrate
Confirm the actual provider name from the package README or composer.json before running this.
First place to look: the package README and src/ directory for the counter trait, service/facade, config file, and migration stubs. The first practical use case is attaching the package’s counter behavior to an Eloquent model, then incrementing and reading a count from a controller, listener, or tinker session.
Since 3.0.0 only updates Laravel support, existing 2.x usage should mostly carry over. Validate the same flows after upgrading rather than expecting new APIs.
update(['count' => ...]).PostViewed and let a listener increment the counter. This keeps controllers thin and makes retries/queueing easier.RefreshDatabase and assert that the count changes by the expected amount, including repeated increments and decrements.3.0.0 is a breaking compatibility change for older Laravel versions. It targets Laravel 13. Applications on Laravel 12 or earlier should pin ^2.0 and defer the upgrade until the framework upgrade is complete.3.0.0 as a compatibility bump: upgrade Composer constraints, run the full test suite, and verify migrations/config still publish correctly.composer.json before upgrading in CI or production.tinker, attach the trait to a test model, call the increment method, and confirm both the returned value and the database row. If that works, move outward to listeners, middleware, and controllers.How can I help you explore Laravel packages today?