Skip to content

Commit 3fe3a56

Browse files
committed
docs: 📚 numbered getting started steps
1 parent 791fe09 commit 3fe3a56

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ composer require andrewdyer/jwt-auth
1616

1717
## 🚀 Getting Started
1818

19-
### Define the JWT Subject
19+
### 1. Define the JWT Subject
2020

2121
Create a class (e.g., `User`) that implements the `JWTSubject` interface. This class must provide a method `getJWTIdentifier` to return the user’s unique identifier.
2222

@@ -36,7 +36,7 @@ class User implements JWTSubject
3636

3737
> **Note:** This example is simplified for demonstration purposes. In a real-world application, you would typically use a proper user model, such as one provided by your framework. Ensure the `getJWTIdentifier` method returns a unique user identifier appropriate for your system.
3838
39-
### Create an Authentication Provider
39+
### 2. Create an Authentication Provider
4040

4141
Create an authentication provider class that implements `AuthProviderInterface`. This class will handle credential validation and user retrieval by ID.
4242

@@ -70,7 +70,7 @@ class AuthProvider implements AuthProviderInterface
7070

7171
> **Note:** This example uses hardcoded credentials for demonstration purposes. In a real-world application, you should validate credentials securely by checking against a database and using hashed passwords (e.g., via libraries like `bcrypt` or `password_hash`). Ensure you follow best practices for secure authentication.
7272
73-
### Create a JWT Provider
73+
### 3. Create a JWT Provider
7474

7575
Create a JWT provider class that implements `JWTProviderInterface`. This class should handle encoding and decoding JWT tokens.
7676

@@ -95,7 +95,7 @@ class JWTProvider implements JWTProviderInterface
9595

9696
> **Note:** This examples used `base64_encode` and `base64_decode` for simplicity. For real-world usage, consider using a proper JWT library such as [firebase/php-jwt](https://github.com/firebase/php-jwt) for better security.
9797
98-
### Generate JWT Claims
98+
### 4. Generate JWT Claims
9999

100100
The `ClaimsFactory` class helps create a JWT claims instance. The `build` method accepts an array of claims and returns an instance of `ClaimsInterface`.
101101

@@ -114,7 +114,7 @@ $claims = ClaimsFactory::build([
114114

115115
> **Note:** This example uses hardcoded Unix timestamps for demonstration purposes. Consider using libraries like [nesbot/carbon](https://github.com/briannesbitt/carbon) or PHP's native `DateTime` class to generate timestamps dynamically. This helps improve readability and ensures accurate date handling.
116116
117-
### Initialize the JWT Authenticator
117+
### 5. Initialize the JWT Authenticator
118118

119119
Create a new instance of the `JWTAuth` class. This requires an instance of `AuthProviderInterface`, `JWTProviderInterface`, and `ClaimsInterface`.
120120

0 commit comments

Comments
 (0)