Download the PHP package nickmoline/stytch-laravel without Composer

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

Stytch Laravel Package

A Laravel package for integrating Stytch authentication into your Laravel application. This package provides seamless integration with Stytch's B2C and B2B authentication services.

Features

Installation

  1. Install the package via Composer:

  2. Publish the configuration file:

  3. Add your Stytch credentials to your .env file:

  4. Run the migration to add the Stytch user ID column:

Configuration

Basic Configuration

The package configuration is located in config/stytch.php. Here are the key options:

Authentication Configuration

Update your config/auth.php to use the Stytch guards and providers:

Usage

User Models

Your user model should implement the Authenticatable contract, the StytchUserContract, and use the provided traits:

The StytchUserContract provides methods for updating user data from Stytch responses without making assumptions about your specific field names. Email handling is already provided by the HasStytchUser trait, while name handling can be customized by overriding the contract methods.

Authentication Methods

The StytchGuard implements Laravel's StatefulGuard interface, providing all standard authentication methods:

Login

Logout

Check Authentication

B2B Organization Support

For B2B applications, you can also use the HasStytchOrganization trait:

Middleware Authentication

The package provides a StytchAuthenticate middleware that automatically handles authentication via Stytch cookies. This middleware:

  1. Checks if the user is already logged in via Laravel sessions
  2. If not logged in, checks for Stytch cookies (session_token or session_jwt)
  3. Authenticates with Stytch using the appropriate method (B2B or B2C)
  4. Finds or creates the user in your database
  5. Logs the user in using Laravel's Auth::login() method

Using the Middleware

Apply the middleware to routes that require authentication:

The middleware is registered as stytch.auth and can be used alongside other Laravel middleware.

Session Management

The guard automatically handles Stytch session tokens and creates Laravel sessions. You can access Stytch session data:

Advanced Usage

Custom Authentication Logic

You can extend the guard or create custom authentication logic:

Multiple Guards

You can use different guards for different parts of your application:

Troubleshooting

Common Issues

  1. "Call to undefined method login()": Make sure you're using the latest version of the package that implements StatefulGuard.

  2. User not found: Ensure your user model uses the HasStytchUser trait and has the correct Stytch user ID.

  3. Session issues: Check that your session configuration is correct and that cookies are being set properly.

Debug Mode

Enable debug mode in your .env file to see detailed error messages:

Security Considerations

Contributing

Please see CONTRIBUTING.md for details.

License

The MIT License (MIT). Please see License File for more information.


All versions of stytch-laravel with dependencies

PHP Build Version
Package Version
Requires nickmoline/stytch-php Version ^0.9.1
illuminate/support Version >=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 nickmoline/stytch-laravel contains the following files

Loading the files please wait ....