From 21946e3a22fbf0bfdadfd4093994a62d4d3ed9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maurice=20Preu=C3=9F=20=28envoyr=29?= Date: Mon, 28 Apr 2025 05:32:44 +0200 Subject: [PATCH] update docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurice Preuß (envoyr) --- README.md | 40 +++++++++++++++++++++------------------- README.stub | 40 +++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 34848d8..56103f6 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,11 @@ PHP Anikeen ID API Client for Laravel 11+ ## Table of contents 1. [Installation](#installation) -2. [Event Listener](#event-listener) -3. [Configuration](#configuration) -4. [General](#general) -5. [Examples](#examples) -6. [Documentation](#documentation) -7. [Development](#Development) +2. [Configuration](#configuration) +3. [General](#general) +4. [Examples](#examples) +5. [Documentation](#documentation) +6. [Development](#Development) ## Installation @@ -22,19 +21,9 @@ PHP Anikeen ID API Client for Laravel 11+ composer require anikeen/id ``` -## Event Listener - -In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your `AppServiceProvider` - -``` -Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { - $event->extendSocialite('anikeen-id', \Anikeen\Id\Socialite\Provider::class); -}); -``` - ## Configuration -Add environmental variables to your `.env` +Add environmental variables to your `.env` file: ``` ANIKEEN_ID_KEY= @@ -44,7 +33,7 @@ ANIKEEN_ID_CALLBACK_URL=http://localhost/auth/callback You will need to add an entry to the services configuration file so that after config files are cached for usage in production environment (Laravel command `artisan config:cache`) all config is still available. -**Add to `config/services.php`:** +Add to `config/services.php` file: ```php 'anikeen' => [ @@ -55,6 +44,19 @@ You will need to add an entry to the services configuration file so that after c ], ``` +### Event Listener + +In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your `AppServiceProvider` boot method: + +```php +public function boot(): void +{ + Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { + $event->extendSocialite('anikeen-id', \Anikeen\Id\Socialite\Provider::class); + }); +} +``` + ### Registering Middleware Append it to the global middleware stack in your application's `bootstrap/app.php` file: @@ -86,7 +88,7 @@ then, you can use the `Billable` trait methods in your user model. ### Change the default access token / refresh token field name -If you access / refresh token fields differs from the default `anikeen_id_access_token` / `anikeen_id_refresh_token`, you can specify the field name in the 'AppServiceProvider' boot method: +If you access / refresh token fields differs from the default `anikeen_id_access_token` / `anikeen_id_refresh_token`, you can specify the field name in the `AppServiceProvider` boot method: ```php use Anikeen\Id\AnikeenId; diff --git a/README.stub b/README.stub index 9b77ed2..d93c71f 100644 --- a/README.stub +++ b/README.stub @@ -9,12 +9,11 @@ PHP Anikeen ID API Client for Laravel 11+ ## Table of contents 1. [Installation](#installation) -2. [Event Listener](#event-listener) -3. [Configuration](#configuration) -4. [General](#general) -5. [Examples](#examples) -6. [Documentation](#documentation) -7. [Development](#Development) +2. [Configuration](#configuration) +3. [General](#general) +4. [Examples](#examples) +5. [Documentation](#documentation) +6. [Development](#Development) ## Installation @@ -22,19 +21,9 @@ PHP Anikeen ID API Client for Laravel 11+ composer require anikeen/id ``` -## Event Listener - -In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your `AppServiceProvider` - -``` -Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { - $event->extendSocialite('anikeen-id', \Anikeen\Id\Socialite\Provider::class); -}); -``` - ## Configuration -Add environmental variables to your `.env` +Add environmental variables to your `.env` file: ``` ANIKEEN_ID_KEY= @@ -44,7 +33,7 @@ ANIKEEN_ID_CALLBACK_URL=http://localhost/auth/callback You will need to add an entry to the services configuration file so that after config files are cached for usage in production environment (Laravel command `artisan config:cache`) all config is still available. -**Add to `config/services.php`:** +Add to `config/services.php` file: ```php 'anikeen' => [ @@ -55,6 +44,19 @@ You will need to add an entry to the services configuration file so that after c ], ``` +### Event Listener + +In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your `AppServiceProvider` boot method: + +```php +public function boot(): void +{ + Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { + $event->extendSocialite('anikeen-id', \Anikeen\Id\Socialite\Provider::class); + }); +} +``` + ### Registering Middleware Append it to the global middleware stack in your application's `bootstrap/app.php` file: @@ -86,7 +88,7 @@ then, you can use the `Billable` trait methods in your user model. ### Change the default access token / refresh token field name -If you access / refresh token fields differs from the default `anikeen_id_access_token` / `anikeen_id_refresh_token`, you can specify the field name in the 'AppServiceProvider' boot method: +If you access / refresh token fields differs from the default `anikeen_id_access_token` / `anikeen_id_refresh_token`, you can specify the field name in the `AppServiceProvider` boot method: ```php use Anikeen\Id\AnikeenId;