NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #4775 most downloaded on Packagist
A minimalistic analytics package for Laravel with seamless view tracking for Eloquent models
Latest stable
v9.0.0
Last release 13 days ago
08 Nov 2026
Release timing varies
gaps range from 2 weeks to 1.1 years
Nearly every release is documented
notes for 50 of 50 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
55 releases · first in 2017
Drag across the ruler to compare, or tap a release to open it.
Version 9 adds dashboards, rankings, viewer tracking, cookieless visitors and a Redis buffer, and reorganises the package into modules. See the upgrad
Version 9 adds dashboards, rankings, viewer tracking, cookieless visitors and a Redis buffer, and reorganises the package into modules. See the upgrade guide for the steps to upgrade.
views route middleware, Http\Middleware\RecordViews, which records the model bound to a route once a GET request gets a successful response. Route parameters or model classes pick what to record, collection, cooldown and queue options apply, and RecordViews::using() builds the middleware stringrecording.beacon.enabled and print the @viewsBeacon($post) Blade directive; the page posts to a signed route once it has loaded. Http\Beacon::url() builds the URL for a script of your ownrecording.guards config list and the Recording\Contracts\RecordingGuard contract for your own. The new IgnorePrefetch, IgnoreHeadRequests and IgnoreMissingUserAgent guards are on by default and drop prefetched pages, HEAD requests and requests without a user agent. The new IgnoreGlobalPrivacyControl guard, off by default, honours Sec-GPC: 1ThrottleVisitors guard, off by default, which caps the views one visitor records per minute across every model. Configure it under recording.throttleIgnoreBursts guard, on by default, which refuses a visitor that opens more than 8 different models within 2 seconds, and blocks them for 2 minutes. It counts per visitor id and per network and user agent, so a bot that drops its cookie is caught too. Configure it under recording.bursts. Recording\Events\BurstDetected is dispatched when a block startsRecording\Contracts\LimitsRepeats marker interface, implemented by EnforceCooldown and ThrottleVisitors. A view such a guard refuses is skipped only once every other guard allowed it, and still keeps its visitor active; a heartbeat never asks these guards10.0.0.0/8, to recording.ignored_ip_addressesViews::attempt(), which records like record() and returns a Recording\Data\RecordResult saying whether the view was stored or queued, or which guard skipped it, and with presence on, whether the visitor was kept active. Recording\Events\ViewSkipped is dispatched when a guard refuses a viewRecording\Events\ViewAttempted, dispatched for every view the guards have judged with its RecordResult, in the request that made it, also when the write is queued. It is only built when something listens. RecordResult serialises to JSON with the guard named by its classfruitcake/laravel-debugbar 4.4 or newer installed, a Viewable tab lists the views stored, queued and skipped in the request, with the guard that refused each. Turn it off with debugbar.collectors.eloquent_viewableViews::context(?array $context) and a nullable context JSON column to store extra data with a viewrecording.store.driver: database, the default, redis, array and null. Add your own Recording\Contracts\ViewStore with StoreManager::extend()redis store driver, which buffers views in a Redis stream and lands them in the views table in batches through the views:flush command or Recording\Jobs\FlushBufferedViewsJob. Needs Redis 7 or newer or any release of Valkey, and phpredis or Predis 3.3 or newercooldown.store: session, the default, and cache, which also works without a session. Add your own with CooldownManager::extend()viewer_type and viewer_id columns, the recording.viewer.enabled and recording.viewer.guard config options, and Views::viewedBy(), to link a view to the signed-in model and count the views of one modelwhereViewedBy(), whereNotViewedBy(), whereViewedByVisitor() and whereNotViewedByVisitor() scopesConcerns\HasViewHistory trait with viewed(), hasViewed() and lastViewedAt(), and a viewer relation and byViewer() and byVisitor() scopes on the View modelvisitor.identity config option: cookie, the default, viewer, which counts one account as one visitor on every device, and fingerprint, which counts guests without a cookie by a hash that rotates daily. Set visitor.fingerprint.rotation to week or month to rotate it less oftenvisitor.cookie.lifetime config option, in minutes. It still defaults to five yearsContracts\ViewerCanOptOut contract and the IgnoreOptedOutViewers guard, on by default, which drops the views of a viewer whose tracksViews() returns false, for a "don't record my reading history" account setting. It asks the signed-in user also when recording.viewer.enabled is off, and views:doctor warns when the viewer model implements the contract but the guard is not listedforgetViewHistory(), anonymiseViewHistory() and exportViewHistory() to Concerns\HasViewHistory, and the views:forget-viewer and views:forget-visitor commands, to erase or export the views of one person. They reach views in the Redis buffer, forget the remembered counts and recount the counter columns of the models touched, and dispatch Erasure\Events\ViewHistoryForgotten, ViewHistoryAnonymised and ViewHistoryExported. Rollups are left as they arecountByInterval(), which returns a gap-filled Querying\Series\ViewSeries of counts per hour, day, week, month or year, with labels(), values(), peak(), average() and JSON output. Views::timezone() aligns its buckets to another timezone, and querying.max_intervals caps the number of bucketsViews::compare() and Period::previous(), which compare a period with the one before itViews::countByCollection(), the counts of every collection at onceViews::top(), a ranking of the most viewed models across every type or within oneViews::alsoViewed(), a ranking of what the visitors of one model also viewed, bounded by the querying.also_viewed.minimum_visitors and querying.also_viewed.max_visitors config options. A view source of your own supports it by implementing Querying\Contracts\RanksAlsoViewedViews::forViewables() and counts(), which count a set of models you already have in one queryViews::returning() and Views::countByFrequency(), which count the visitors who viewed a model on two days or more within the period, and how many visitors viewed on one day, on two, and so on, as a Querying\Frequency\VisitFrequency with new(), returning(), total(), returningShare() and JSON output. Views without a visitor and anonymised views are left out. Only count() and compare() read returning(); every other read throws Querying\Exceptions\InvalidReturning instead of ignoring it. A view source of your own supports them by implementing Querying\Contracts\CountsVisitFrequencywhereViewsCount() and whereUniqueViewsCount() scopesPeriod::parse(), which refuses a shorthand of zero such as 0d, route model binding for Period, and an optional timezone argument on the relative Period constructorsViews::forgetCache() and Views::flushCache() to forget remembered counts, on every cache storeremember(): remember(10, stale: 60) serves an expired answer at once and counts it again after the response, one process at a time, as Cache::flexible() does. Folds and rebuilds of the pairs mark remembered answers stale instead of forgetting them, so with a stale window a read after views:maintain does not wait. Forgetting, deleting, erasing, anonymising and pruning are never served stalequerying.source.driver. Add your own Querying\Contracts\ViewSource with SourceManager::extend(), and a bucket grammar for another database driver with Querying\Grammars\GrammarRegistryQuerying\Contracts\SubquerySource contract, which a source implements so the scopes can read from it. A source that does not throws Querying\Exceptions\UnsupportedBySource from a scopeQuerying\Contracts\IdentifiesSource contract, whose cacheIdentity() keeps the remembered counts of a source apart per settingQuerying\Contracts\TracksChangedViewables contract, which lets a source of your own say which viewables a count may have changed for, so views:recount recounts only thoseViews::trending() and the orderByTrending() and withTrendingScore() scopes, which rank models by views weighed by their age, so recent views count more. Entry has a score. Configure them under querying.trendingQuerying\Ranking\DecayCurve contract with the ExponentialDecay, LinearDecay and Window curves, to choose or write how a view loses weightQuerying\Contracts\RanksTrending and TrendingSubquerySource contracts, which a source of your own implements to support trending() and the trending scopesrecommended() on Concerns\HasViewHistory and on Views, for the viewer viewedBy() names or the current visitor, and the recommendedFor() scope, which keeps the recommended models of a query ordered by a selected recommendation_score. They rank what the visitors of the viewer's most recent views also viewed, weighed by recency and by cosine similarity, leave out what the viewer viewed unless includeSeen is passed, and give each Querying\Recommendations\Recommendation the views it came from in because. Configure them under querying.recommendations. A view source of your own supports them by implementing Querying\Contracts\RanksRecommendationsalsoViewed() and recommended() read instead of the views table when a call names no collection and either no period or a relative period as long as one of querying.pairs.periods, such as Period::pastDays(30) for 30d. views:pairs rewrites the pairs of every period, or of one with --period, and dispatches Querying\Pairs\Events\ViewsPaired for each. Configure it under querying.pairsViews::rising(), which ranks the models whose count grew the most against the previous period, Views::anomalies(), which ranks them by how many standard deviations their count lies from the same period on past weeks or days, spikes with a positive threshold and drops with a negative one, and Views::againstBaseline(), which compares one model with its own past as a Querying\Growth\Baseline. Every Entry of their rankings has the baseline it was compared with. A view source of your own supports them by implementing Querying\Contracts\CountsByWindowhot option of a counter column and the orderByHot() scope. The recount writes a Reddit-style score, the logarithm of the count plus a term that grows with the model's created_at or another timestamp column, so new content gets a head start and the column can be indexedmilestones.thresholds, checked by every recount. Milestones\Events\ViewMilestoneReached is dispatched once per model and threshold, after the mark that keeps it from firing again is committed, with the model's morph type and key, viewable() and is(). The first recount, and the one after a threshold is added, marks the models already past it without dispatching. views:seed-milestones marks every model by handviews:detect-spikes, which compares the last closed window of the models under spikes.types with the same window on past weeks or days, and dispatches Spikes\Events\ViewsSpiked or ViewsDropped once when a model leaves its baseline and ViewsSettled once it has been back to normal for the cooldown. The events carry the model's morph type and key, viewable() and is(), and the baseline it was compared withviews($post)->activeVisitors(), and live() with count(), counts() for a set, top() for a ranking of what is being looked at, viewers() for the signed-in viewers and within() to narrow the window. It reads a viewable, a type or, through Views::live(), the whole site, within a collection when one is set. Turn it on with presence.enabledredis presence driver, which works against Redis or Valkey and stores every active visitor, or with presence.precision set to approximate estimates the count with a HyperLogLog per minute. All keys share one hash tag, so on a Redis Cluster they live on the same node. Writes Redis refuses are reported, not thrown. The array and null drivers and Presence\Contracts\PresenceStore with PresenceManager::extend() cover tests and stores of your ownViews::heartbeat() and Views::leave(), which keep a visitor active without recording a view and stop counting them at once, and @viewsBeacon($post, live: true), whose script sends a heartbeat every presence.heartbeat seconds while the page is visible and leaves when it closes. With presence.expose_count the heartbeat answers with the count, which the script writes into [data-views-live] elements and dispatches as a views:live event. Http\Beacon::presenceUrl() and leaveUrl() build the signed URLspresent(), assertPresent(), assertNotPresent() and assertLeft() to Views::fake()views:anonymise anonymises views older than retention.anonymise.after, views:prune deletes views older than retention.prune.after, and views:maintain runs every step from one scheduler lineviews:rollup folds views into day, month or other tiers per grouping, and the rollup source reads them, so history and fast all-time counts outlive deleted views. Anonymising and pruning wait for views a rollup has not folded yet, and a tier removed from the config leaves no rows behindQuerying\Rollups\Rollup with a filter, tiers, groupings and one dimension, listed under retention.rollups.custom. Views::rollup() reads one and Views::countByDimension() counts per value of its dimension, through the new Contracts\FiltersViews and Querying\Contracts\CountsByDimension contractsquerying.counters lists columns on your own tables that views:recount fills with a view count, and views:maintain runs it. A recount only touches the models whose counts can have changed since the last one; --full, and the run after views:purge-bots, recount every model, and views($post)->destroy() recounts the post's columns right away. Every recount dispatches Querying\Counters\Events\CountersRecounted with the model class and the keys it wrote. A unique column leaves out anonymised views--before to views:prune, for an application that drops partitions of the views table itselfviews:purge-bots, which deletes the views inside a burst, the views IgnoreBursts would have refused, and folds the rollups again. Views of a signed-in viewer are kept unless --include-viewers is passed, and --whole-visitor deletes every view of a visitor with several bursts. Dispatches Retention\Events\BotViewsPurged. Rollups expose the new Querying\Rollups\Contracts\Refolder contract for it--max-seconds to views:maintain, views:rollup, views:anonymise, views:prune and views:recount. Once the time is up, a run finishes the bucket, day or chunk in progress and stops, and the next run carries on from thereview_state table, in which retention, rollups, milestones and recounts keep their marks, behind the Contracts\StateStore contractMaintenance\Jobs\MaintainViewsJob, which runs what views:maintain runs for at most maxSeconds and queues itself again while there is work left, for hosts that cut long scheduled commands offRetention\Events\ViewsAnonymised, ViewsPruned and Querying\Rollups\Events\ViewsRolledUp events, and the RetentionNotInstalled, RollupsNotInstalled, ResolutionUnavailable and LockUnavailable exceptionsdimensions.definitions, all off by defaultSource, Medium, Campaign, ReferrerHost, Device and Country dimensions, with a source list of referring hosts written for the package that dimensions.sources and dimensions.source_aliases extend, and the CloudflareCountry and HeaderCountry resolvers behind Dimensions\Contracts\CountryResolverDimensions\Dimension and the Dimensions\Contracts\Dimension contract for dimensions of your own. Every dimension takes the personal, maxValues and json options in config, and DimensionInput::fake() builds the input for a unit testViews::countBy(), which returns a Querying\Dimensions\DimensionCounts of the views per value with none(), other(), total() and share(), and Views::whereDimension(), which narrows every count, series and ranking. A view source of your own supports them by implementing Querying\Contracts\CountsBydimensions argument to every scope that counts views, orderByViews(), orderByUniqueViews(), withViewsCount(), whereViewsCount(), whereUniqueViewsCount(), orderByTrending(), withTrendingScore(), the whereViewedBy() family and recommendedFor(), and a dimensions option to the columns in querying.counters, each mapping a dimension to one value or a list of valuesviews:dimensions command, which writes a migration that adds the columns the views table lacks, and copies values from context into a column with --backfillretention.rollups.dimensions, which folds a dimension into a rollup of its own, views:{name}, keeping its top values per bucket and the rest as other. A dimension can keep some of the tiers of retention.rollups.tiers, such as 'country' => ['tiers' => ['day', 'month']], to leave out its hour rowsViews::arrivedFrom() and Dimensions\Arrival, for a view whose referrer and landing page are not the current request's. The beacon posts them from the pageView::factory()->withDimensions(), and the dimensions of every recorded view to Views::fake(), RecordResult, ViewAttempted and the Debugbar tabviews:doctor, which checks the setup and says what to fix: the views table, its columns and indexes, the optional indexes the config relies on, shared cache stores for cooldowns, the throttle, the burst guard and the fingerprint salt, the scheduler running views:maintain or MaintainViewsJob and views:flush, trusted proxies when the visitor's IP address is read, the server behind the Redis stream, Redis or Valkey, and its backlog, and settings that undo each other. --strict fails on warnings, --only runs some checks and --json prints the findingsviews:doctor, which run once a feature is configured: the pairs, milestones and spikes tables, that views:detect-spikes is scheduled, and the (viewable_type, viewed_at) index once spikes.types is set. The Dimensions check, and dimension findings in the schema and index checks, cover the dimension columns and advise leaving out the hour tier of a dimension once it holds 100,000 rows. The Rollups check warns about a rollup that starts after views it should count and names the refold that folds themLegacy config check to views:doctor, which fails on a top-level v8 key left in the published config, such as honor_dnt or ignored_ip_addresses, and on a cooldown block without a store, and names where each value goes in v9doctor.checks config list and the Doctor\Contracts\Check contract for checks of your owndoctor.sample, which counts the attempts each guard refuses so views:doctor can warn when IgnoreCrawlers refuses more than doctor.sample.crawler_share of themRedisStreamStore::backlog(), which describes the views waiting in the Redis stream, and RedisStreamStore::server(), which names the server and its version as a Recording\Data\RedisServermodels.view.class config option to use your own View modelViews::fake() with assertRecorded(), assertNotRecorded(), assertNothingRecorded(), assertForgotten() and recorded(). The scopes throw UnsupportedBySource under the fake, apart from recommendedFor(), which reads the fakeQuerying\Sources\ArraySource, which counts view records held in memory the way the database source counts the views table. Views::fake() reads through itView::factory() with the fromVisitor(), inCollection(), viewedAt(), by() and withContext() statesExceptions\EloquentViewableException marker interface, implemented by every exception the package throws, and the InvalidConfiguration, InvalidViewable, InvalidViewer and InvalidTimezone exceptionseloquent-viewable-development skill in resources/boost, which boost:install offers to coding agentsnesbot/carbon 3.11 or newer, the first release whose add() and sub() accept a Carbon\UnitPeriod is half-open: the start is included and the end is excluded, so a view recorded exactly at the end no longer countsPeriod converts bounds built in another timezone to the application timezone(viewable_type, viewable_id, viewed_at) index, an index on viewed_at and the viewer and context columns. Existing installations add them with the migration in the upgrade guidecache is now querying.cache, queue is recording.queue, ignored_ip_addresses is recording.ignored_ip_addresses and visitor_cookie_key is visitor.cookie.name. Config values are validated when read and throw InvalidConfiguration when invalidrecording.guards. The defaults keep the v8 checks and add IgnorePrefetch, IgnoreHeadRequests, IgnoreMissingUserAgent and IgnoreBursts, which refuses bursts of views from one visitor, so counts can drop. IgnoreOptedOutViewers is on as well, but only acts on a viewer model that implements Contracts\ViewerCanOptOutCreateView, StoreView, ViewRecordException and PendingView have new names. The upgrade guide has the full tableVisitor::DNT is now Visitor::DoNotTrackHeaderRecording\Contracts\RecordsViews::handle() receives a Data\ViewRecord and returns voidRecording\Events\ViewRecorded carries the Data\ViewRecord as $record instead of the model as $view, and no longer uses SerializesModelsView model events no longer fire when a view is storedVisitors\Contracts\Visitor declares viewer(), userAgent(), hasGlobalPrivacyControl(), isPrefetch() and isHeadRequest(). The shipped Visitor constructor takes the request, Support\Config, the cookie jar and the auth factory, and no longer takes a CrawlerDetectorCrawlers\Contracts\CrawlerDetector::isCrawler() receives the user agent to judgeContracts\Viewable declares shouldRemoveViewsOnDelete(), and its scopeOrderByViews() and scopeOrderByUniqueViews() take a last array $dimensions = [] argument. InteractsWithViews implements both; a model that implements the contract without the trait adds themCacheKey is now Querying\Cache\CacheKey, and make() takes a ViewsQuery. Remembered counts are recalculated once after upgrading, and again when the source driver or its connection changesViews::destroy() and deleting a model forget the counts remembered of itModels\View prefers its own $table and $connection properties over the configViews constructor takes the visitor, Recording\Recorder, Querying\Reader, Recording\Actions\DestroyViews, Querying\Cache\CacheVersions, Dimensions\DimensionRegistry, Presence\LiveViews and the containerRecording\Jobs\RecordViewJob has no static dispatch() method. Use dispatch(new RecordViewJob($record))illuminate/bus, illuminate/container, illuminate/queue and illuminate/routing components and no longer uses Illuminate\Foundationmigrations tag publishes every table the package uses: views, view_state, view_rollups, view_pairs, view_milestones and view_spikes. The features that use them stay off until configured. A migration whose file the application already has is skipped, so publishing again adds only the missing ones, and the stubs are anonymous classesContracts\View and Contracts\Views interfaces. Extend Models\View and name it in models.view.class. Views can no longer be replaced through the container$removeViewsOnDelete model property in favour of shouldRemoveViewsOnDelete()Visitors\Contracts\Visitor::isCrawler()ignore_bots and honor_dnt config keys. List or unlist the guards in recording.guards insteadCooldownManager::push()Views facade carrying the viewable, period, collection and every other option of one call into the next within a request. See the upgrade guidePeriodInterval::subtract() mutating the date instance passed to itVisitor instance in the same requestYour coding agent can read these notes before it upgrades. Set up the MCP server →
Visitor now receives the cookie jar through its constructor (Illuminate\Contracts\Cookie\QueueingFactory) and reads the existing visitor cookie from t
Visitor now receives the cookie jar through its constructor (Illuminate\Contracts\Cookie\QueueingFactory) and reads the existing visitor cookie from the injected request, instead of going through the Cookie facade (breaking only for subclasses that override the constructor)views() helper now throws an InvalidArgumentException when given a class name that does not implement Contracts\Viewable, instead of a TypeError from deeper inside the packageViewableObserver now skips soft deletes and only destroys views on a force delete, so a restored model keeps its view count. If you relied on a soft delete purging views, call views($model)->destroy() yourselfCooldownManager built the session key to forget from an empty array_column() result, so it removed the whole namespace instead of the one expired entryVisitor::hasDoNotTrackHeader() always returning false; it looked the header up as HTTP_DNT, which is the $_SERVER key, while Laravel's header bag exposes it as DNT (the Visitor::DNT constant now holds 'DNT')orderByUniqueViews() and withViewsCount(unique: true) ordering and counting by total views instead of distinct visitors; Laravel drops the extra select added inside a withCount constraint, so the distinct count is now passed as the aggregate expression…instead of reading env('DB_CONNECTION') and the deprecated env('CACHE_DRIVER') (only affects newly published config)
See the upgrade guide for detailed migration instructions.
^8.5Views contract now declares the existing useVisitor() method (breaking only for classes that implement Contracts\Views directly)cooldown() and remember() parameters on the Views contract to be typed DateTimeInterface|int|nullscopeWithinPeriod() method on the View contract to declare a void return typePeriod::getStartDateTime()/getEndDateTime() to return ?CarbonInterfaceInvalidPeriod and ViewRecordException exceptions as final (breaking only for code that extends them)Viewable contract now uses @mixin \Illuminate\Database\Eloquent\Model instead of redeclaring the getKey() and getMorphClass() methodsView contract now uses @mixin \Illuminate\Database\Eloquent\Model and declares the existing scopeCollection() method (breaking only for classes that implement Contracts\View directly)create_views_table migration stub (typed properties and return types)visitor column in the create_views_table migration stub from text to string (VARCHAR(255)) so it can be indexed directly (only affects newly published migrations)models.view.connection and cache.store to null, so they now defer to the application's default database connection and cache store instead of reading env('DB_CONNECTION') and the deprecated env('CACHE_DRIVER') (only affects newly published config)Period as a final, immutable (readonly) value object; relative periods are now built with the new Support\PeriodInterval and Support\PeriodAnchor enums, and date parsing defers to Carbon::make() (the factory methods, getStartDateTime()/getEndDateTime(), and the cache-key format are unchanged)illuminate/* now requires ^13.0)nesbot/carbon now requires ^3.0)getStartDateTimeString(), getEndDateTimeString(), getStartDateTimestamp() and getEndDateTimestamp() getters from PeriodPeriod::PAST_* and Period::SUB_* constants and the sub(), subToday() and subNow() static helpersPeriod::getSubType(), getSubValue(), hasFixedDateTimes(), setStartDateTime(), setEndDateTime(), setFixedDateTimes(), setSubType() and setSubValue() methods (Period is now immutable)Fixed cooldown pruning when the session uses JSON serialization, where expires_at is restored as a string instead of a Carbon instance
expires_at is restored as a string instead of a Carbon instance (#326)Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.1.0...v7.1.1
### Changed - Add support for Laravel 13
Implicitly marking parameter $collection as nullable is deprecated, the explicit nullable type must be used instead. by @mstnorris in https://github.c…
Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.0.5...v7.0.6
scopeOrderByUniqueViews()refactor: fix deprecation warning. by @mikebronner in https://github.com/cyrildewit/eloquent-viewable/pull/312
Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.0.4...v7.0.5
View::scopeCollection() and CooldownManagerSupport Laravel 12 by @bosunski in https://github.com/cyrildewit/eloquent-viewable/pull/302
Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.0.3...v7.0.4
Allow Carbon v3 by @cyrildewit in https://github.com/cyrildewit/eloquent-viewable/pull/299
Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.0.2...v7.0.3
Laravel 11 support by @janyksteenbeek in https://github.com/cyrildewit/eloquent-viewable/pull/295
Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v7.0.1...v7.0.2
fixed deprecated variable in string by @Mahmoud217TR in https://github.com/cyrildewit/eloquent-viewable/pull/280
Full Changelog: https://github.com/cyrildewit/eloquent-viewable/compare/v6.1.0...v7.0.1
Add support for Laravel 9 (@atmonshi)
Revert breaking change of remember method in Views contract. The $lifetime variable has now a default value of null.
remember method in Views contract. The $lifetime variable has now a default value of null.Revert breaking change of remember method in Views class. The $lifetime variable has now a default value of null.
remember method in Views class. The $lifetime variable has now a default value of null.Added bool return typehint to record method in Views contract.
bool return typehint to record method in Views contract.void return typehint to destroy method in Views contract.ViewRecordException will be thrown when trying to record a view for a viewable type.ViewRecorded event will be fired when a new view is recorded.Views typehint to global views() function.bool return typehint to isCrawler method in CrawlerDetector contract.composer.json to ^7.4|^8.0.View instance has been moved into its own method protected function createView(): View.$viewable argument of the forViewable method in Views contract cannot be nullable anymore.orderByViews and orderByUniqueViews query scope in Viewable contract and InteractsWithViews trait.withViewsCount query scope in InteractsWithViews trait.Period class typehint to $period argument of period method in Views contract.$name argument nullable in Views contract.ip method in Visitor contract to ?string.DateTime typehint to DateTimeInterface in InvalidPeriod exception.lifetime_in_minutes option from config file.count method of Views class to count all views, including the collections (#241).Nothing published for this version
### Changed - Add support for Laravel 8
Use CyrildeWit\EloquentViewable\Contracts\Views to resolve Views instance from container.
CyrildeWit\EloquentViewable\Contracts\Views to resolve Views instance from container.Remove default value (null) for viewable in views() helper.
null) for viewable in views() helper.Removed the deprecated overrideIpAddress method from the Views class.
Views contract.Visitor contract.Visitor class which represents the current visitor.getViewableTypeSlug() to CacheKey::class.orderByViews query scope to Viewable trait.orderByUniqueViews query scope to Viewable trait.withViewsCount query scope to Viewable trait.CyrildeWit\EloquentViewable\Viewable trait has been renamed to CyrildeWit\EloquentViewable\InteractsWithViews.session.key to cooldown.key in configuration file.Views class constructor arguments. Added the Visitor as first argument and removed VisitorCookieRepository $visitorCookieRepository, rawlerDetector $crawlerDetector and IpAddressResolver $ipAddressResolver.$this->crawlerDetector in Views with new Visitor class implementation.requestHasDoNotTrackHeader in Views with new Visitor class implementation.increments to bigIncrements in views table migration.^6.0|^7.0.getConnectionName(), getDatabaseName(), getModelSlug() and getKeySlug in CacheKey::class.ViewSessionHistory class to CooldownMananger.CooldownManager class. The Illuminate\Contracts\Config\Repository has been added as first parameter and the cooldown key is now retrieved from this instance.Views class now implements the Views contract.Views class has been changed.Facades/Views to src/ and renamed it to ViewsFacade.views() helper now supports viewable types.nesbot/carbon ^1.22.overrideIpAddress method from the Views class.overrideVisitor method from the Views class.requestHasDoNotTrackHeader method from Views class.$viewableType argument from constructor of CacheKey::class.fromViewableType method from CacheKey::class.HeaderResolver contract and class.IpAddressResolver contract and class.uniqueVisitor() scope from View model.Enums\SortDirection class.OrderByViewsScope class.countByType method from the Views class.VisitorCookieRepository (logic is move to the Visitor class).Nothing published for this version
Nothing published for this version
Nothing published for this version
Update required dependencies in composer.json to adhere to new Laravel 6 verison scheme
### Changed - Add support for Laravel 6
Deprecated the overrideIpAddress method of the Views class. Please use the new useIpAddress(string $address) method instead.
SortDirection enum class that contains a DESCENDING and ASCENDING constantOrderByViewsScope class that can order a query by views based on some optionscollection($collection) query scope to View modelorderByViews and orderByUniqueViews query scopeCacheKey class with a new improved approach to making keys for the cachegetStartDateTimestamp and getEndDateTimestamp methods to the Period class for internal usestring $collection = null argument to push, createNamespaceKey and createViewableKey methods in ViewSessionHistoryoverrideIpAddress method of the Views class. Please use the new useIpAddress(string $address) method instead.overrideVisitor method of the Views class. Please use the new useVisitor(string $visitor) method instead.orderByViews and orderByUniqueViews query scope with the new OrderByViewsScope classstring type declaration from the getTable method in the View model class #165Support\Key class with its referencesUse String and Array classes instead of the helper functions
Fixed the ability to pass an integer to the delayInSession method without getting an error
delayInSession method without getting an errorThe method delayInSession isn't working properly
delayInSession isn't working properlyPublishing package migrations results in error
Added IpAddressResolver contract with implementation
Views class with facadeIpAddressResolver contract with implementationHeaderResolver contract with implementationVisitorCookieRepository classviewscollection column to views table shemawithinPeriod scope to View modeluniqueVisitor scope to View modelViewable contractviews() helperisBot method name to isCrawler in CrawlerDetector contract and updated the CrawlerDetectAdapter$detector property from protected to private5.7.* of illuminate/config to composer.jsonpublishable/config to config/create_views_table stub with real migration file and load it inside the service providerPeriod classPeriod class to the Key classViewTracker classViewableService classProcessView jobupdate_views_table migration file from resources/database/migrationsilluminate/bus as dependencyilluminate/queue as dependencyilluminate/routing as dependencyorderByViewsCount scope doesn't adhere to connection prefix
orderByViewsCount scope doesn't adhere to connection prefixData too long for column visitor
visitorProcessView job is always failing
View is saved before ProcessViews job is ran
Deprecated the CyrildeWit\Support\IpAddress class
CyrildeWit\Support\IpAddress classCyrildeWit\Viewtracker classscopeOrderByViewsCount method in the Viewable traitscopeOrderByUniqueViewsCount method in the Viewable traitAdd orderByUniqueViewsCount scope to Viewable trait
orderByUniqueViewsCount scope to Viewable traitAdd the ability to add a delay between views from the same session
This release accidentally contains no updates.
This release accidentally contains no updates.
Added visitor collumn to the create_views_table migration stub
visitor collumn to the create_views_table migration stubcyrildewit/laravel-page-view-counter to cyrildewit/eloquent-viewableHasPageViewCounter trait to ViewablePageViewCounterServiceProvider class to EloquentViewableServiceProviderCyrildeWit\PageViewCounter\xxx to 'CyrildeWit\EloquentViewable'addPageView method with addView in the Viewable traitgetPageViews<suffix> methods with getViews in the Viewable traitaddPageViewThatExpiresAt method from the Viewable traitThis major version contains some serious breaking changes! See the upgrade guide for more information!
visitor column to the create_views_table migration stubcyrildewit/laravel-page-view-counter to cyrildewit/eloquent-viewableHasPageViewCounter trait to ViewablePageViewCounterServiceProvider class to EloquentViewableServiceProviderCyrildeWit\PageViewCounter\xxx to 'CyrildeWit\EloquentViewable'addPageView method with addView in the Viewable traitgetPageViews<suffix> methods with getViews in the Viewable traitaddPageViewThatExpiresAt method from the Viewable traitAdd PageViewCounter to autoload path in composer.json (#50).
PageViewCounter to autoload path in composer.json (#50).Use the Request facade for getting the ip address of the visitor instead of creating a new empty request
Request facade for getting the ip address of the visitor instead of creating a new empty request (#39)Use ->getKey() method to get the models primary key value, instead of using the static attribute id #35.
->getKey() method to get the models primary key value, instead of using the static attribute id #35.This fix was added by @peyman3d.
This fix was added by @peyman3d.
retrievePageViews() method in HasPageViewCounter because they were overriding each other.Removed the protected transformDate() method from the HasPageViewCounter trait and put it into his own helper class: DateTransformer.
transformDate() method from the HasPageViewCounter trait and put it into his own helper class: DateTransformer.Added the UniquePageViewsBefore() method to the HasPageViewCounter trait.
UniquePageViewsBefore() method to the HasPageViewCounter trait.ViewViewableTest.phpfromCamelCaseToDashes() method in SessionHistory with the provided snake_case() method of Laravel.VisitVisitableTest.phpIn the past few days I've been working on a new version of this package. My goal was to get rid of all the attributes that are appended to your model.
In the past few days I've been working on a new version of this package. My goal was to get rid of all the attributes that are appended to your model. So, guess what? They are all gone! The are replaced by methods. You can still create your own attributes.
This release is quite stable! But not ready for production. There are maybe a few bugs. If you find one please report it in the issue tracker. With this release I hope that I could get some feedback.
HasPageViewCounter.phpPageViewCounterServiceProvider.phpPageVisitsCounter to PageViewCounter.Cyrildewit\PageVisitsCounter -> CyrildeWit\PageViewCounter.page-visits-counter.php -> page-view-counter.php.PageVisit.php -> PageView.phpHelpers/HasPageVisitsCounter.php.PageVisitsCounterServiceProvider.php.SessionHistory class.The Eloquent model will now pass the fillable attributes
The composer.json now consists of package auto discovery.
composer.json now consists of package auto discovery.README.md file have been updated. They all now now have a similar style.README.md file.VisitVisitableTest.php file to single quotes.Improved the comments inside the following files: PageVisitsCounterServiceProvider.php, HasPageVisitsCounter.php and SessionHistory.php.
README.md.CHANGELOG.md file.PageVisitsCounterServiceProvider.php, HasPageVisitsCounter.php and SessionHistory.php.string and int type hints from the code.A default value for retrieving the table name of page-visits from the config file.
LICENSE file.page-visits from the config file.README.md.fromCamelCaseToDashes( string $value ) inside the SessionHistory class.VisitVisitableTest.PageVisitsCounterServiceProvider.HasPageVisitsCounter.The .travis.yml file to integrate TravisCI into this project.
.travis.yml file to integrate TravisCI into this project.README.md.New configurable settings to the config file. Developers can now change the primary session key that is used to store the visit history of the users.
SessionHistory class for providing an elegant way of checking and adding new visits into the session of the user.HasPageVisitsCounter trait. Added two methods: addVisitThatExpiresAt( Carbon $expires_at ) and addVisitThatExpiresAtAndCountAll().tests/Models/Task model for using inside the TestCases.tests/TestCase.php).VisitVisitableTest with one method it_can_store_new_visits_into_the_database() and.README.md. Updated old code examples.phpunit.xml. From tests to tests/TestCases.CyrildeWit/.. to Cyrildewit/.. inside Models/PageVisit.php and Traits/HasPageVisitsCounter.php.Improved the README.md file and updated the code examples.
README.md file and updated the code examples.retrievePageVisitsFrom to retrievePageVisitsCountFrom inside the HasPageVisitsCounter trait.convertNumber function inside the HasPageVisitsCounter trait. It now returns an object with two properties: number and formatted.The initial release of the Laravel Page Visits Counter package.
The initial release of the Laravel Page Visits Counter package.
.gitattributes, .gitignore, composer.json and phpunit.xml.HasPageVisitsCounter) that can be added to Eloquent models.PageVisit) for storing the page visits into the database.PageVisit Eloquent model because it can be changed within the configuration file. It uses Laravels Service Container to updates this automatically.One column per quarter.