Download the PHP package julienlinard/auth-php without Composer

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

Auth PHP - Complete Authentication System

🇬🇧 Read in English

💝 Support the project

If this bundle is useful to you, consider becoming a sponsor to support the development and maintenance of this open source project.


A complete and modern authentication system for PHP 8+ with user management, roles, permissions, customizable guards and integration with JulienLinard packages.

Current Version: 1.1.0 | Tests: 64 tests, 133 assertions (100% passing) | Strict Types: ✅ Enabled

📋 Table of Contents

🚀 Installation

Requirements:

⚡ Quick Start

Minimal Example

📖 Configuration

Complete Configuration

Minimal Configuration

🔐 Authentication

Login with Credentials

Login with "Remember Me"

Direct Login (without password verification)

Logout

Checks

👥 Roles and Permissions

Check a Role

Check a Permission

Implementation in User Entity

🛡️ Middlewares

AuthMiddleware

Protects a route by requiring authentication.

Parameters:

RoleMiddleware

Protects a route by requiring a specific role.

Parameters:

PermissionMiddleware

Protects a route by requiring a specific permission.

Parameters:

GuestMiddleware

Protects a route by requiring that no user is authenticated (for login/registration pages).

Parameters:

Usage with Route Groups

🔌 User Providers

DatabaseUserProvider (default)

Uses doctrine-php to retrieve users from the database.

Custom User Provider

Create your own provider by implementing UserProviderInterface.

🛡️ Guards

SessionGuard (default)

Uses PHP sessions to store authentication state.

Custom Guard

Create your own guard by implementing GuardInterface.

🔒 Hashers

PasswordHasher (default)

Uses native PHP hash functions.

Custom Hasher

Create your own hasher by implementing HasherInterface.

🔗 Integration with Other Packages

Integration with core-php

Integration with doctrine-php

Integration with php-router

📚 API Reference

AuthManager

__construct(array $config)

Creates a new AuthManager instance.

attempt(array $credentials, bool $remember = false): bool

Attempts to authenticate a user with credentials.

login(UserInterface $user, bool $remember = false): void

Authenticates a user directly without password verification.

logout(): void

Logs out the current user.

check(): bool

Checks if a user is authenticated.

guest(): bool

Checks if no user is authenticated.

user(): ?UserInterface

Returns the currently authenticated user.

id(): int|string|null

Returns the ID of the currently authenticated user.

hasRole(string $role): bool

Checks if the user has a specific role.

can(string $permission): bool

Checks if the user has a specific permission.

guard(): GuardInterface

Returns the current guard.

💡 Complete Examples

Example 1: Complete Application with Authentication

🧪 Tests

The library includes a comprehensive test suite with 64 tests and 133 assertions, ensuring reliability and quality.

Test Coverage

Test Results: 100% passing (64/64 tests)

Code Quality

📝 License

MIT License - See the LICENSE file for more details.

🤝 Contributing

Contributions are welcome! Feel free to open an issue or a pull request.

📧 Support

For any questions or issues, please open an issue on GitHub.

💝 Support the project

If this bundle is useful to you, consider becoming a sponsor to support the development and maintenance of this open source project.


Developed with ❤️ by Julien Linard


All versions of auth-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
julienlinard/core-php Version ^1.0
julienlinard/doctrine-php 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 julienlinard/auth-php contains the following files

Loading the files please wait ...