Download the PHP package ra-devs/jwt-auth without Composer

On this page you can find all versions of the php package ra-devs/jwt-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jwt-auth

๐Ÿ” ra-devs/jwt-auth

**Production-ready JWT authentication package for Laravel** Built on top of [`tymon/jwt-auth`](https://github.com/tymondesigns/jwt-auth) + [`ra-devs/api-json-response`](https://github.com/YasMax91/api-json-response) [![Laravel](https://img.shields.io/badge/Laravel-10%2B%20%7C%2011%2B%20%7C%2012%2B-red?style=flat-square&logo=laravel)](https://laravel.com) [![PHP](https://img.shields.io/badge/PHP-8.1%2B-blue?style=flat-square&logo=php)](https://php.net) [![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE)

โœจ Features

Feature Description
๐Ÿ”‘ Authentication Complete auth flow: Login, Register, Logout, Token Refresh
๐Ÿ”’ Password Reset Secure 8-character alphanumeric codes (Aโ€“Z, 2โ€“9) via email
๐Ÿ›ก๏ธ Security Rate limiting, event logging, custom exceptions
๐Ÿ“Š Monitoring Security event logging for audit trails
๐ŸŽฏ Error Handling Structured error responses with error codes
โšก Performance Database indexes, optimized queries
๐Ÿงช Testing Comprehensive test suite with >80% coverage
๐Ÿ“š Documentation OpenAPI spec, examples, FAQ
๐Ÿ”ง Customizable User model, Resources, Repositories, Notifications
๐Ÿ“ฆ Publishable Config, migrations, routes, views

๐Ÿ“‹ Table of Contents


๐Ÿš€ Installation

Step 1: Install Dependencies

Install the required packages via Composer:

Step 2: Publish Package Resources

Publish the configuration, migrations, and views:

Step 3: Configure JWT Auth

Publish and configure the base JWT package:

Step 4: Configure Auth Guard

Update your config/auth.php file:

Step 5: Run Migrations

Run the database migrations:

This will create the following tables:


๐ŸŽฏ Quick Start

1. Register a New User

Response:

2. Login

Response:

3. Access Protected Route

4. Refresh Token

The refresh token is automatically sent as an HTTP-only cookie. To refresh:


๐Ÿ“ก API Endpoints

All endpoints are prefixed with /api/auth by default (configurable).

Method Endpoint Description Auth Required Rate Limit
POST /login Authenticate user and get tokens โŒ 5/min
POST /register Register a new user โŒ 3/min
GET /me Get current authenticated user โœ… -
POST /logout Logout and clear refresh token โœ… -
POST /refresh Refresh access token via cookie โœ… 10/min
POST /forgot-password Request password reset code โŒ 3/min
POST /reset-password Reset password using code โŒ 3/min

Request/Response Examples

POST /api/auth/login **Request:** **Success Response (200):** **Error Response (401):**
POST /api/auth/register **Request:** **Success Response (201):**
POST /api/auth/forgot-password **Request:** **Success Response (200):** **Note:** For security, the response is the same whether the email exists or not.
POST /api/auth/reset-password **Request:** **Success Response (200):** **Error Response (400):**

โš™๏ธ Configuration

After publishing, edit config/ra-jwt-auth.php to customize the package behavior.

Route Configuration

Refresh Token Cookie

Custom Classes

Override default implementations:

Registration Fields

Customize registration validation rules:

Password Reset Settings

Rate Limits

Configure rate limiting per endpoint:


๐Ÿ’ก Usage Examples

Custom User Resource

Create a custom resource to control API responses:

Then update config/ra-jwt-auth.php:

Custom Repository

Override authentication logic:

Custom Password Reset Notification

Create a custom email template:


๐Ÿ›ก๏ธ Security Features

Rate Limiting

All endpoints are protected with configurable rate limits to prevent brute force attacks:

When rate limit is exceeded, the API returns:

Security Event Logging

All authentication events are automatically logged with IP address and user agent:

Listen to events in your EventServiceProvider:

Error Codes

Structured error responses with error codes for programmatic handling:

Error Code Description
INVALID_CREDENTIALS Wrong email/password combination
USER_NOT_FOUND User does not exist
INVALID_TOKEN Token is invalid or expired
PASSWORD_RESET_CODE_EXPIRED Reset code has expired
PASSWORD_RESET_CODE_INVALID Invalid reset code
PASSWORD_RESET_TOO_MANY_ATTEMPTS Too many code verification attempts
RATE_LIMIT_EXCEEDED Too many requests

Password Reset Security


๐ŸŒ Frontend Integration

Vue.js / React

See detailed integration examples in docs/EXAMPLES.md for:

Quick Example (Axios)


๐Ÿงช Testing

Run Tests

Test Coverage

The package includes a comprehensive test suite:

Current Status: 21/21 passing (100%)

โœ… All tests are passing successfully! See Testing Guide for details.


๐Ÿ“š Documentation


๐Ÿ”ง Customization

Override User Model

Ensure your User model implements JWTSubject:

Custom Validation Rules

Extend the request classes to add custom validation:

Custom Routes

Override routes by publishing and editing routes/api.php, or add middleware:


๐Ÿšง Development

Local Development Setup

For local development, add the package as a path repository in composer.json:

Then require it:

Project Structure


๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guidelines before submitting a pull request.

Quick Contribution Steps

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add/update tests
  5. Update documentation
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

๐Ÿ“„ License

MIT ยฉ RA Devs


**Made with โค๏ธ by [RA Devs](https://github.com/YasMax91)** [Report Bug](https://github.com/YasMax91/ra-devs-jwt-auth/issues) ยท [Request Feature](https://github.com/YasMax91/ra-devs-jwt-auth/issues) ยท [Documentation](docs/)

All versions of jwt-auth with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/support Version >=10.0
illuminate/http Version >=10.0
illuminate/notifications Version >=10.0
illuminate/validation Version >=10.0
illuminate/database Version >=10.0
illuminate/mail Version >=10.0
tymon/jwt-auth Version ^2.0
ra-devs/api-json-response Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ra-devs/jwt-auth contains the following files

Loading the files please wait ...