Download the PHP package nrikiji/breeze-api without Composer
On this page you can find all versions of the php package nrikiji/breeze-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package breeze-api
laravel-breeze-api
This is a package for easy implementation of API endpoints based on Breeze.
Since it provides only API, it does not have any files (blade, javascript, css) related to Breeze's View.
It is also used in conjunction with Sanctum to implement authentication by session and authentication by token in SPA.
setup
Next, install sanctum
Use the HasApiTokens trate in the User model to use API tokens
app/Models/User.php
Add middleware to the API to use Sanctum and sessions
app/Http/Kernel.php
If cors is required
※ example
backend : http://localhost:8000
frontend : http://localhost:3000
.env
app/config/cors.php
To enable user email authentication
Implement the MustVerifyEmail interface
app/Models/User.php
If you need to send an email
Used for email address verification and password reset functions
Configure the mail server
.env
Set the URL for the link that will be included in the confirmation email.
app/Http/Providers/AuthServiceProvider.php
Usage
API Token
User Registration
Resend URL for user email address verification
User email address verification
*The endpoint is determined from the URL in the body of the email.
Login
User information
Logout
Password reset
Password reset2
- Get the token from the body of the confirmation email.
SPA
axios example
for cors, set withCredentials=true
User Registration
Resend URL for user email address verification
User email address verification
*The endpoint is determined from the URL in the body of the email.
Login
User information
Logout
Password reset
Password reset2
- Get the token from the body of the confirmation email.
trouble shooting
API responses become HTML (text) instead of JSON.
Add "Accept: application/json" to the HTTP request header. Laravel will try to make the response JSON when using Ajax requests or when this header is specified. Laravel will try to make the response JSON when requesting via Ajax or when this header is specified.
However, we have prepared HandleAuthApiRequests middleware for cases where it is not possible to add this header. Please use it as appropriate. This can be enabled by adding it to app/Http/Kernel.php.
Link
All versions of breeze-api with dependencies
illuminate/filesystem Version ^8.42
illuminate/support Version ^8.42
illuminate/validation Version ^8.42