Download the PHP package danilowa/laravel-api-auth without Composer

On this page you can find all versions of the php package danilowa/laravel-api-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 laravel-api-auth

Streamline API Authentication with Laravel API Auth! This simple and configurable package provides an easy solution for managing API authentication in Laravel applications using Laravel Sanctum. It includes features for user registration, login, logout, and retrieving current user data, all with standardized JSON responses.

Index

Features

Requirements

Ensure your project meets the following requirements before using this package:

Installation

To integrate the Laravel API Auth into your Laravel project, follow these steps:

  1. Install via Composer:

Run the following command in your terminal:

  1. Publish the Configuration (Optional):

After installation, publish the configuration file:

This will create a configuration file at config/apiauth.php, where you can customize the package settings.

Configuration

The package configuration can be found in the config/apiauth.php file. This file allows you to customize various aspects of the API authentication system according to your project's needs.

Key Configurations:

  1. Route Prefix:

    • route_prefix: Allows you to define a custom prefix for all authentication routes. By default, it's set to auth. You can customize this via the API_AUTH_ROUTE_PREFIX environment variable, making it easy to change to v1/auth, for example.
  2. User Model Configuration:

    • user_model: Specify the class name of the user model that will be used for authentication. The default is App\Models\User::class. If you have a custom user model, change this value accordingly.
  3. Token Settings:

    • default_token_name: Defines the default name for the access tokens generated during registration or login. You can use a different name for each token if desired.
  4. Token Revocation Strategy:

    • revoke_all_tokens: A boolean value that determines whether all tokens for a user should be revoked upon logout. If set to true, all tokens will be revoked; if false, only the current token will be revoked.
  5. Customizable Messages:

    • messages: Allows you to customize the messages returned during the authentication process. For example, you can modify messages like "User created successfully!" to fit your communication style.
  6. Validation Rules:

    • validation: Defines the validation rules for login and registration requests. You can adjust these rules to meet your application's policies, including format requirements for email or password strength.

Configuration Example

API Endpoints

This package provides the following API endpoints for user authentication:

Usage Examples

Register User

To register a new user, send a POST request to /auth/register with the following JSON body:

Login User

To log in, send a POST request to /auth/login:

Logout User

To log out the authenticated user, send a POST request to /auth/logout.

Retrieve Current User

To retrieve the current user's data, send a GET request to /auth/user with the appropriate authentication token.

Documentation

API Endpoints

Register

Login

Logout

Current User

Contributing

You can contribute by forking the repository and submitting a pull request.

License

This package is licensed under the MIT License.

Contact

For any questions or feedback, please reach out to:


All versions of laravel-api-auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2
laravel/framework Version ^8.0|^9.0|^10.0|^11.0|^12
laravel/sanctum Version *
danilowa/laravel-api-response-builder 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 danilowa/laravel-api-auth contains the following files

Loading the files please wait ...