Download the PHP package laraverse/laravel-auth without Composer

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

laraverse/laravel-auth

Laravel Sanctum token APIs with 6-digit OTP email verification, OTP password reset, soft-deleted accounts, and JSON-driven RBAC (Spatie Permission).

Requirements

Those packages are required by this library and must be installed in the host app.

Install

publish:sanctum-auth

Copies all Sanctum auth and RBAC source into the host app (namespaces become App\...) so the code lives in your project. After this, you can remove the package and the APIs still work.

--force overwrites existing files (including app/Models/User.php). --migrate / --seed run after publishing.

Duplicate *personal_access_tokens* files in database/migrations are deleted; Sanctum creates that table from vendor.

php artisan publish:session-auth currently forwards to publish:sanctum-auth (session/web auth is not implemented).

This publishes:

Destination What
app/Http/Controllers/Auth/ Register, login, logout, email OTP, password, profile
app/Http/Requests/ Form requests
app/Http/Resources/UserResource.php API user resource
app/Http/Middleware/ RoleMiddleware, PermissionMiddleware
routes/auth.php Auth API routes (/api/auth/...)
app/Services/ AuthService, OtpService, PasswordService, ProfileService, RoleAndPermissionService
app/Notifications/ Email verification and password-reset OTP mails
app/Traits/ApiResponse.php JSON response helper
app/Concerns/HasUserPermissions.php Direct-permission checks
app/Enums/ UserRole, OtpPurpose
app/Models/ User, Role, Permission, Otp
app/Docs/roles_and_permissions.json RBAC JSON
app/Console/Commands/PermissionAssignCommand.php permission:assign
database/migrations/ Users (if missing), permissions/roles, soft deletes, otps
database/seeders/ PermissionSeeder, RoleSeeder, LaravelAuthSeeder
database/factories/UserFactory.php User factory
config/laravel-auth.php App User model; load_package_routes is false
app/Providers/AuthApiServiceProvider.php Loads routes/auth.php, middleware, Spatie models
postman/Laravel-Auth.postman_collection.json Postman collection for all auth APIs

It also registers AuthApiServiceProvider in bootstrap/providers.php. After this command, package routes are disabled so only the published files handle auth.

Then seed with:

--force overwrites app/Models/User.php. Review that file after publishing.

Remove the package after publishing

Yes — the app can keep working without laraverse/laravel-auth once the code is published.

publish:sanctum-auth copies auth/RBAC into app/ and routes/auth.php, registers AuthApiServiceProvider, and adds laravel/sanctum and spatie/laravel-permission to the host composer.json (so Composer does not delete them when you remove this package).

Then:

Do not remove Sanctum or Spatie. Auth APIs, OTP, and RBAC then run only from your published files.

User model

If you do not run publish:sanctum-auth, add these traits to your User model:

After publish:sanctum-auth, use the published App\Models\User (traits come from App\Concerns).

Auth guard

In config/auth.php, use a Sanctum guard (this package defaults laravel-auth.guard to sanctum):

Set LARAVERSE_AUTH_GUARD=sanctum in .env if you override the default.

Point the users provider at App\Models\User after publishing, or at the package model:

Seed roles and permissions before registering users.

API

Prefix: api/auth (LARAVERSE_AUTH_PREFIX). Guest routes need no token. Protected routes use Authorization: Bearer {token}.

Routes live in routes/auth.php after publish:sanctum-auth.

Method Path Body Auth
POST /api/auth/register name, email, password, password_confirmation Guest
POST /api/auth/email/verify email, otp Guest
POST /api/auth/email/resend email Guest
POST /api/auth/login email, password Guest (verified users only)
POST /api/auth/logout — Sanctum (revokes current token)
POST /api/auth/forgot-password email Guest
POST /api/auth/reset-password email, otp, password, password_confirmation Guest
PUT /api/auth/password current_password, password, password_confirmation Sanctum
GET /api/auth/profile — Sanctum + view-profile
PUT /api/auth/profile name, email Sanctum + update-profile
DELETE /api/auth/account — Sanctum (soft delete)

Register creates an unverified user, assigns the default user role, and emails an OTP. No token is issued until login after verification.

Login returns a Sanctum token and user resource. Unverified users get 403. Soft-deleted users cannot log in.

Changing profile email clears email_verified_at and sends a new verification OTP.

OTP

Soft delete

DELETE /api/auth/account sets deleted_at, revokes all tokens, and prefixes the email with deleted_{id}_ so the original address can register again. Soft-deleted users cannot log in.

RBAC

Published JSON: app/Docs/roles_and_permissions.json (package source: resources/rbac/roles_and_permissions.json). Override path with laravel-auth.rbac_json_path.

Role Permissions
admin dashboard, view-profile, update-profile
user dashboard, view-profile, update-profile

Re-sync a role’s users after JSON changes:

Example responses

Success (ApiResponse::successResponse):

Error (ApiResponse::errorResponse):

Postman

After publish:sanctum-auth, import:

postman/Laravel-Auth.postman_collection.json

In Postman: Import → File and select that JSON.

Collection variables: base_url (default http://localhost:8000), email, password, otp, token. Login saves token automatically. Put OTP codes from storage/logs/laravel.log when MAIL_MAILER=log.


All versions of laravel-auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/notifications Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
laravel/sanctum Version ^4.0|^5.0
spatie/laravel-permission Version ^6.0|^7.0|^8.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 laraverse/laravel-auth contains the following files

Loading the files please wait ...