Download the PHP package pictastudio/auth without Composer

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

pictastudio/auth

Latest Version on Packagist Total Downloads

Opinionated API authentication and authorization for Laravel using Sanctum and Spatie roles/permissions.

Features

Installation

Install Auth

Configuration

Permissions are generated from config/picta-auth.php under picta-auth.permissions.

For API-only projects, you can also point notification links to frontend routes:

Password reset validation rules are configurable via picta-auth.password_rules:

If you publish the Bruno collection, create your local env file from the template:

bruno/auth/environments/Local.bru is gitignored so personal values are not tracked.

Generated permission names follow:

Generate Permissions and Roles

This command keeps existing records and only creates missing permissions/roles.

User Model Trait

Use the package trait on your User model to get:

Global Helper

API Routes

Mounted under /api/auth by default:

Registration

POST /api/auth/register accepts:

Optional payload fields:

Like login, registration defaults to cookie auth for stateful frontend requests and bearer token auth for non-stateful requests.

Login Modes

POST /api/auth/login supports both Sanctum modes:

Optional payload fields:

To use cookie-based SPA auth, make sure your frontend domain is in config/sanctum.php (sanctum.stateful) and keep picta-auth.routes.stateful_middleware enabled.

Frontend Integration (Cookie Auth)

Use this flow when your first-party frontend authenticates with cookies (Sanctum stateful mode) instead of bearer tokens.

1. Backend setup

Set your frontend as a stateful domain and allow cross-site credentials.

Example .env:

Example config/cors.php:

Notes:

2. Frontend request flow

  1. Get CSRF cookie: GET /api/auth/csrf-cookie with credentials.
  2. Login: POST /api/auth/login with email/password and credentials.
  3. Read current user: GET /api/auth/me with credentials.
  4. Logout: POST /api/auth/logout with credentials.

3. Frontend example (Axios)

4. Frontend example (Fetch)

5. If login still returns tokens

POST /api/auth/login can still issue bearer tokens when:

Morph Map

Inside your AppServiceProvider add this to ensure the relation morph map is registered:

Testing


All versions of auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/auth Version ^12.0 || ^13.0
illuminate/console Version ^12.0 || ^13.0
illuminate/contracts Version ^12.0 || ^13.0
illuminate/http Version ^12.0 || ^13.0
illuminate/routing Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
laravel/sanctum Version ^4.0
spatie/laravel-permission Version ^7.4
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 pictastudio/auth contains the following files

Loading the files please wait ...