Download the PHP package whilesmart/eloquent-client-credentials without Composer

On this page you can find all versions of the php package whilesmart/eloquent-client-credentials. 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 eloquent-client-credentials

Eloquent Client Credentials

Add OAuth2 client credentials authentication to any Eloquent model.

Installation

Publish the config file:

Run migrations:

Configuration

Usage

Using the Default Client Model

Enable routes in your config:

This registers the following routes:

Method URI Description
POST /api/oauth/token Issue access token
POST /api/oauth/revoke Revoke access token
GET /api/clients List clients
POST /api/clients Create client
GET /api/clients/{slug} Get client
PUT /api/clients/{slug} Update client
DELETE /api/clients/{slug} Delete client
POST /api/clients/{slug}/regenerate-secret Regenerate secret

Adding Client Credentials to Your Own Model

Use the HasClientCredentials trait:

The trait provides:

Owner Resolver

Configure how the owner is resolved for client operations. Create a custom resolver:

Register in config:

You can also pass an owner directly when using the controller programmatically:

OAuth2 Token Flow

Issuing Tokens

Client Credentials Grant:

Response:

Refresh Token Grant (when enabled):

Revoking Tokens

Middleware

Bearer Token Authentication

Authenticate requests using OAuth2 bearer tokens:

Basic Auth

Authenticate using HTTP Basic Authentication:

Credentials: client_id:client_secret base64 encoded.

Header-Based Authentication

Authenticate using custom headers:

Headers required:

Registering Middleware

In your bootstrap/app.php or service provider:

Hook System

Add custom logic before/after controller actions:

Create a hook class:

Available hook actions (from HookAction enum):

Models

Client

Default client model with:

AccessToken

OAuth2 access tokens with:

RefreshToken

Refresh tokens with:

Publishing Assets

Testing

License

MIT


All versions of eloquent-client-credentials with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/database Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
cviebrock/eloquent-sluggable Version ^11.0|^12.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 whilesmart/eloquent-client-credentials contains the following files

Loading the files please wait ...