Download the PHP package tihloh/prefab-auth without Composer

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

Prefab Auth

Prefab Auth provides framework-independent authentication for PHP applications while allowing the host project to keep ownership of its users, database and application structure.

Use only password authentication if that is all you need. Add social authentication and other integrations when the application grows.

Auth does not own the project's user table. Any compatible user source can be connected through the Auth contracts, including Prefab Users or a project/framework adapter.

Requirements

Installation

Responsibilities

Prefab Auth handles authentication concerns such as:

It deliberately does not require the application to replace its existing user model or database design.


1. Password authentication

If Prefab Users is already available, normal usage is intentionally small:

Auth resolves missing compatible resources on first use. You do not normally call internal Prefab configuration methods yourself.

For a completely standalone Auth installation, provide your own user provider explicitly:

A custom session implementation may also be supplied when needed.


2. Current authenticated user

Typical use:


3. Automatic session isolation

Prefab Auth separates its native PHP session from other applications by default.

For example:

No session configuration is required for this protection.

Prefab also namespaces its own session keys so that even when PHP was started before Auth, Prefab authentication values remain application-scoped.

The default resolution is:

An explicit shared namespace may be configured through the global Prefab configuration:

Using the same explicit namespace gives applications the same Prefab session identity. By default an explicit namespace uses cookie path /; path and domain can be overridden for unusual deployments or cross-host sharing.

Optional shared session settings include:

Session isolation is the default. Sharing must be intentional through common configuration.


4. User-provider ownership

Prefab Auth authenticates users; it does not require its own users table.

A compatible user object implements AuthenticatableUserInterface. Existing project models, Prefab Users, Laravel model adapters or another implementation can participate without making Auth dependent on one storage design.


5. Cooperation with Prefab Users

Prefab Auth accepts any identifier string. When Prefab Users is connected, Auth delegates identifier resolution to Users.

By default, Users resolves login identifiers by email only. Projects may configure one or more mapped login fields:

With a mapping such as:

the normal Auth API accepts either username or email:

Auth itself remains identifier-agnostic. Prefab Users owns the configured lookup fields. Older Users integrations that do not expose findByIdentifier() continue to fall back to email lookup.

Prefab Users publishes a compatible user-provider capability. Auth can discover it automatically:

Normal application code remains:

Explicit configuration always remains available and wins over automatic discovery.


6. Cooperation with Prefab Logs

When Prefab Logs is available, Auth can discover its logger capability and record infrastructure authentication events such as login, failed login and logout.

The application does not need to insert audit rows around every authentication call.


7. Authentication result

Authentication returns a result instead of forcing HTML, JSON, redirects or exceptions for normal credential failure:

Useful request context can be supplied:


8. Social authentication

Social authentication is optional. Providers are registered through SocialProviderRegistry and may implement Prefab's provider contract directly or use a callback adapter.

Native OAuth state storage uses the same isolated Prefab session scope as password authentication.


9. Starting social sign-in


10. Handling the social callback

OAuth state is validated as part of the flow.


11. Permissions and Routes

Auth answers who the current user is. Permissions answers what that user may do. Routes may consume authentication/authorization capabilities through compatible integration.

The modules remain independently installable.


12. Error handling

Prefab Auth should fail as a library, not take over the host application. Missing required providers/resources produce clear, catchable exceptions. Invalid credentials return a normal authentication result.


13. Diagnostics

Automatic integration can be inspected when troubleshooting:

Normal application code does not need this.


14. API quick reference

API Purpose
attempt() Authenticate credentials
login() Authenticate an already-resolved compatible user
check() Determine whether a user is authenticated
id() Return the authenticated user's ID
user() Return the authenticated user
logout() End the current authenticated session
explain() Inspect resolved Prefab integrations

15. Design philosophy

The simple authentication API remains the same as the application grows.

That is the goal of Prefab Auth: authentication that can stand alone, cooperate automatically when useful, isolate itself safely by default, and never require the application to become a specific framework.


All versions of prefab-auth with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
tihloh/prefab-core Version ^0.4 || ^0.5
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 tihloh/prefab-auth contains the following files

Loading the files please wait ...