PHPackages                             tehwave/laravel-achievements - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tehwave/laravel-achievements

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tehwave/laravel-achievements
============================

Simple, elegant Achievements the Laravel way

v2.0.0(2mo ago)7012.8k—6%5[1 PRs](https://github.com/tehwave/laravel-achievements/pulls)MITPHPPHP ^8.2CI passing

Since Mar 28Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/tehwave/laravel-achievements)[ Packagist](https://packagist.org/packages/tehwave/laravel-achievements)[ Docs](https://github.com/tehwave/laravel-achievements)[ RSS](/packages/tehwave-laravel-achievements/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (24)Used By (0)

[![](https://camo.githubusercontent.com/877ea31ad215c83a42cafbb7913c65bdc3f6cefe3b3fd2ec820e46c7e1532b2b/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230416368696576656d656e74732e6a7065673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d746568776176652532466c61726176656c2d616368696576656d656e7473267061747465726e3d776967676c65267374796c653d7374796c655f31266465736372697074696f6e3d53696d706c652532432b656c6567616e742b416368696576656d656e74732b7468652b4c61726176656c2b776179266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/877ea31ad215c83a42cafbb7913c65bdc3f6cefe3b3fd2ec820e46c7e1532b2b/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230416368696576656d656e74732e6a7065673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d746568776176652532466c61726176656c2d616368696576656d656e7473267061747465726e3d776967676c65267374796c653d7374796c655f31266465736372697074696f6e3d53696d706c652532432b656c6567616e742b416368696576656d656e74732b7468652b4c61726176656c2b776179266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

Laravel Achievements
====================

[](#laravel-achievements)

Simple, elegant Achievements the Laravel way.

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Automated Tests](https://github.com/tehwave/laravel-achievements/actions/workflows/automated-tests.yml/badge.svg)](https://github.com/tehwave/laravel-achievements/actions/workflows/automated-tests.yml)

Requirements
------------

[](#requirements)

The package has been developed and tested to work with the latest supported versions of PHP and Laravel as well as the following minimum requirements:

- Laravel 11
- PHP 8.2

### Version Compatibility

[](#version-compatibility)

LaravelPHPBranch11+8.2+[master](https://github.com/tehwave/laravel-achievements/tree/master)10 and below8.1 and below[1.x](https://github.com/tehwave/laravel-achievements/tree/1.x)Installation
------------

[](#installation)

Install the package via Composer.

```
composer require tehwave/laravel-achievements
```

Publish migrations.

```
php artisan vendor:publish --tag="achievements-migrations"
```

Migrate the migrations.

```
php artisan migrate
```

As an optional choice, you may publish config as well.

```
php artisan vendor:publish --tag="achievements-config"
```

Usage
-----

[](#usage)

`Laravel Achievements` work much like Laravel's [notifications](https://laravel.com/docs/notifications).

```
$user = \App\User::find(1);

$user->achieve(new \App\Achievements\UsersFirstPost());
```

### Creating Achievements

[](#creating-achievements)

```
php artisan make:achievement UsersFirstPost
```

This command will place a fresh `Achievement` class in your new `app/Achievements` directory.

Each `Achievement` class contains a `toDatabase` method, that you may use to store additional data with the achievement, and a few properties for basic meta information.

### Unlocking Achievements

[](#unlocking-achievements)

Use `Achiever` trait on models that can unlock achievements.

```
