PHPackages                             think.studio/laravel-recently-viewed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. think.studio/laravel-recently-viewed

ActiveLibrary

think.studio/laravel-recently-viewed
====================================

Package to make quickly recently viewed functionality

4.2.1(1y ago)115.6k↓100%10[1 PRs](https://github.com/dev-think-one/laravel-recently-viewed/pulls)MITPHPPHP ^8.1

Since Jun 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dev-think-one/laravel-recently-viewed)[ Packagist](https://packagist.org/packages/think.studio/laravel-recently-viewed)[ Docs](https://github.com/dev-think-one/laravel-recently-viewed)[ RSS](/packages/thinkstudio-laravel-recently-viewed/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (6)Versions (14)Used By (0)

Laravel: Recently Viewed
========================

[](#laravel-recently-viewed)

[![Packagist License](https://camo.githubusercontent.com/18f458ed6ba6ceeed5df550ad1fc0bf6ff0fe841e6eab024e7a7326be0e3013b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6c61726176656c2d726563656e746c792d7669657765643f636f6c6f723d253233346463373166)](https://camo.githubusercontent.com/18f458ed6ba6ceeed5df550ad1fc0bf6ff0fe841e6eab024e7a7326be0e3013b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6c61726176656c2d726563656e746c792d7669657765643f636f6c6f723d253233346463373166)[![Packagist Version](https://camo.githubusercontent.com/7073b8ddace20859fc5321e7c58b5ad7f21159a846bfe7bbe67db028ae49e881/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468696e6b2e73747564696f2f6c61726176656c2d726563656e746c792d766965776564)](https://packagist.org/packages/think.studio/laravel-recently-viewed)[![Total Downloads](https://camo.githubusercontent.com/dfbd13ed0b58a43a5de7c691b2b49e0f027022a3a183109c38e3a91ff4cb7497/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468696e6b2e73747564696f2f6c61726176656c2d726563656e746c792d766965776564)](https://packagist.org/packages/think.studio/laravel-recently-viewed)[![Build Status](https://camo.githubusercontent.com/fb96d2621070c4777aefde822dc5195875115157bc18b48cec8672c43aadab62/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d726563656e746c792d7669657765642f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-recently-viewed/build-status/main)[![Code Coverage](https://camo.githubusercontent.com/4f5b254b4037051addb0adaaee41d43bcbedfdbb06fe0453805a4223570ab299/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d726563656e746c792d7669657765642f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-recently-viewed/?branch=main)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/71d1c0f58c8c28a756be8c3702ad8caff1292d5b7935c6632f96230cf890297e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d726563656e746c792d7669657765642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-recently-viewed/?branch=main)

Add functionality to save/get in session recently viewed entities

You can track any number of entities. Each list will be saved separately.

Session storage (without persist)
---------------------------------

[](#session-storage-without-persist)

For example:

```
"recently_viewed" => array:2 [
  "App\Models\Product" => array:2 [
    0 => 'a3cda131-e599-4802-84ea-a3dddc19fa8c'
    1 => '4413b636-9752-43b3-8361-3ef38c27acf9'
  ]
  "App\Domain\Property" => array:3 [
    0 => 133
    1 => 134
    2 => 653
  ]
]
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require think.studio/laravel-recently-viewed
```

You can publish the config file with:

```
php artisan vendor:publish --provider="RecentlyViewed\ServiceProvider" --tag="config"
```

Configuration in *.env*

```
# Optional
RECENTLY_VIEWED_SESSION_PREFIX=recently_viewed
```

Usage example
-------------

[](#usage-example)

```
