Weave Code
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

Eloquent Viewable Laravel Package

cyrildewit/eloquent-viewable

Track page views on Eloquent models without third-party analytics. Record and count total or unique views, filter by date periods, order models by views, apply cooldowns, and optionally ignore crawlers. Stores each view as a DB record for flexible querying.

View on GitHub
Deep Wiki
Context7
v7.1.0

Changed

  • Add support for Laravel 13
v7.0.6

What's Changed

New Contributors

Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.0.5...v7.0.6

v7.0.5

What's Changed

New Contributors

Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.0.4...v7.0.5

v6.1.0

Changed

v6.0.2

Fixed

  • Revert breaking change of remember method in Views contract. The $lifetime variable has now a default value of null.
v6.0.1

Fixed

  • Revert breaking change of remember method in Views class. The $lifetime variable has now a default value of null.
v6.0.0

Added

  • Added bool return typehint to record method in Views contract.
  • Added void return typehint to destroy method in Views contract.
  • The ViewRecordException will be thrown when trying to record a view for a viewable type.
  • The ViewRecorded event will be fired when a new view is recorded.
  • Added Views typehint to global views() function.
  • Added bool return typehint to isCrawler method in CrawlerDetector contract.

Changed

  • Set required PHP versions in composer.json to ^7.4|^8.0.
  • The creating of the View instance has been moved into its own method protected function createView(): View.
  • The $viewable argument of the forViewable method in Views contract cannot be nullable anymore.
  • Changed the method arguments of orderByViews and orderByUniqueViews query scope in Viewable contract and InteractsWithViews trait.
  • Changed the method arguments of withViewsCount query scope in InteractsWithViews trait.
  • Added nullable Period class typehint to $period argument of period method in Views contract.
  • Made $name argument nullable in Views contract.
  • Changed return typehint of ip method in Visitor contract to ?string.
  • Change DateTime typehint to DateTimeInterface in InvalidPeriod exception.

Removed

  • Removed lifetime_in_minutes option from config file.

Fixed

  • Fixed count method of Views class to count all views, including the collections (#241).
v6.0.0-alpha.1
v5.2.1

Changed

  • Add support for Laravel 8
v5.2.0

Fixed

  • Use CyrildeWit\EloquentViewable\Contracts\Views to resolve Views instance from container.
v5.1.0

Changed

  • Remove default value (null) for viewable in views() helper.
v5.0.0

Added

  • Added Views contract.
  • Added Visitor contract.
  • Added the Visitor class which represents the current visitor.
  • Added protected getViewableTypeSlug() to CacheKey::class.
  • Added orderByViews query scope to Viewable trait.
  • Added orderByUniqueViews query scope to Viewable trait.
  • Added withViewsCount query scope to Viewable trait.

Changed

  • The CyrildeWit\EloquentViewable\Viewable trait has been renamed to CyrildeWit\EloquentViewable\InteractsWithViews.
  • Renamed session.key to cooldown.key in configuration file.
  • Changed the Views class constructor arguments. Added the Visitor as first argument and removed VisitorCookieRepository $visitorCookieRepository, rawlerDetector $crawlerDetector and IpAddressResolver $ipAddressResolver.
  • Replaced calls to $this->crawlerDetector in Views with new Visitor class implementation.
  • Replaced calls to requestHasDoNotTrackHeader in Views with new Visitor class implementation.
  • Changed type of primary key from increments to bigIncrements in views table migration.
  • Bumped minimum requirements for Laravel framework components to ^6.0|^7.0.
  • Removed check for provided viewable type in getConnectionName(), getDatabaseName(), getModelSlug() and getKeySlug in CacheKey::class.
  • Renamed ViewSessionHistory class to CooldownMananger.
  • Changed constructor of CooldownManager class. The Illuminate\Contracts\Config\Repository has been added as first parameter and the cooldown key is now retrieved from this instance.
  • The Views class now implements the Views contract.
  • The constructor of the Views class has been changed.
  • Moved Facades/Views to src/ and renamed it to ViewsFacade.
  • The global views() helper now supports viewable types.

Removed

  • Dropped support for nesbot/carbon ^1.22.
  • Removed the deprecated overrideIpAddress method from the Views class.
  • Removed the deprecated overrideVisitor method from the Views class.
  • Removed requestHasDoNotTrackHeader method from Views class.
  • Removed $viewableType argument from constructor of CacheKey::class.
  • Removed static fromViewableType method from CacheKey::class.
  • Removed HeaderResolver contract and class.
  • Removed IpAddressResolver contract and class.
  • Removed uniqueVisitor() scope from View model.
  • Removed Enums\SortDirection class.
  • Removed OrderByViewsScope class.
  • Removed the countByType method from the Views class.
  • Removed the VisitorCookieRepository (logic is move to the Visitor class).
v5.0.0-alpha.2
v5.0.0-alpha.1
v5.0.0-alpha.0
v4.1.1

Fixed

  • Update required dependencies in composer.json to adhere to new Laravel 6 verison scheme
v4.1.0

Changed

  • Add support for Laravel 6
v4.0.0

Added

  • Added SortDirection enum class that contains a DESCENDING and ASCENDING constant
  • Added OrderByViewsScope class that can order a query by views based on some options
  • Added collection($collection) query scope to View model
  • Added the ability to pass a collection to the orderByViews and orderByUniqueViews query scope
  • Added a new CacheKey class with a new improved approach to making keys for the cache
  • Added getStartDateTimestamp and getEndDateTimestamp methods to the Period class for internal use
  • Added string $collection = null argument to push, createNamespaceKey and createViewableKey methods in ViewSessionHistory

Deprecated

  • Deprecated the overrideIpAddress method of the Views class. Please use the new useIpAddress(string $address) method instead.
  • Deprecated the overrideVisitor method of the Views class. Please use the new useVisitor(string $visitor) method instead.

Changed

  • Replaced inner code of the orderByViews and orderByUniqueViews query scope with the new OrderByViewsScope class
  • Removed the string type declaration from the getTable method in the View model class #165

Removed

  • Removed the Support\Key class with its references
v3.2.0

Added

  • Add support for Laravel 5.8

Changed

  • Use String and Array classes instead of the helper functions
v3.1.0

Fixed

  • Fixed the ability to pass an integer to the delayInSession method without getting an error
  • Type cast the cached views count otherwise PHP's type hint will fail

Added

  • Added the ability to override the visitor's unique ID that's used to distinguish unique views
  • Added the ability to specify a cache store that should be used by this package
v3.0.2

Fixed

  • The method delayInSession isn't working properly
v3.0.1

Fixed

  • Publishing package migrations results in error (#133)
v3.0.0

Added

  • Added Views class with facade
  • Added IpAddressResolver contract with implementation
  • Added HeaderResolver contract with implementation
  • Added VisitorCookieRepository class
  • Added global helper views
  • Added collection column to views table shema
  • Added withinPeriod scope to View model
  • Added uniqueVisitor scope to View model

Changed

  • Bumped minimum required PHP version to ^7.1
  • Require viewable models to implement the Viewable contract
  • Added global views() helper
  • Remove IP address as fallback for visitor cookie when it doesn't exists
  • Changed the isBot method name to isCrawler in CrawlerDetector contract and updated the CrawlerDetectAdapter
  • Changed the visibility of the $detector property from protected to private
  • Add support for 5.7.* of illuminate/config to composer.json
  • Moved config file from publishable/config to config/
  • Replace create_views_table stub with real migration file and load it inside the service provider
  • Allow strings to be passed to the constructor of the Period class
  • Extracted key generation logic from Period class to the Key class

Removed

  • Removed the ViewTracker class
  • Removed the ViewableService class
  • Removed the ProcessView job
  • Removed the update_views_table migration file from resources/database/migrations
  • Removed illuminate/bus as dependency
  • Removed illuminate/queue as dependency
  • Removed illuminate/routing as dependency
v2.5.0

Fixed

  • orderByViewsCount scope doesn't adhere to connection prefix
v2.4.3

Fixed

  • Data too long for column visitor
v2.4.2

Fixed

  • ProcessView job is always failing
v2.4.1

Fixed

  • View is saved before ProcessViews job is ran
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4