Download the PHP package yakovenko/laravel-lighthouse-graphql-multi-schema without Composer

On this page you can find all versions of the php package yakovenko/laravel-lighthouse-graphql-multi-schema. 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-lighthouse-graphql-multi-schema

Lighthouse GraphQL Multi-Schema

Latest Version on Packagist Total Downloads License

yakovenko/laravel-lighthouse-graphql-multi-schema is a Laravel package that provides multi-schema support for Lighthouse GraphQL. It allows you to manage multiple GraphQL schemas within a single Laravel application, streamlining development and extending functionality.

Installation

Requirements

Install the Package

You can install the package using Composer:

Publish Configuration

After installing the package, you need to publish the configuration file by running the following command:

This will create a configuration file named lighthouse-multi-schema.php in the config/ directory, where you can set up your GraphQL schemas.

Configuration

In the config/lighthouse-multi-schema.php file, you can define your schemas and their settings. Here’s an example configuration:

Middleware Support

You can now add middleware specific to each GraphQL schema, allowing you to apply different middleware configurations based on the schema being used. Specify the middleware classes in the middleware array for each schema, and they will be applied to the corresponding routes.

CSRF exceptions Laravel ^11

To disable CSRF verification for your GraphQL routes in Laravel 11, update bootstrap/app.php with the following configuration:

In the code above, routes such as schema1-graphql and schema2-graphql are excluded from CSRF protection. For older Laravel versions, you can still add the routes in VerifyCsrfToken.php.

CSRF exceptions Laravel ^9.0 || ^10

Add your GraphQL routes to the CSRF exceptions.

Open the App/Http/Middleware/VerifyCsrfToken.php file and add your routes to the $except array.

Create Directories for Each Schema

Organize your schema files into separate directories for each schema. The structure of these directories and how you split the files is up to you. Here’s an example of one way to organize them:

Console Command Example

The lighthouse:clear-cache command is used to manage the cache for your GraphQL schemas. Below are the available usages:

1 - Clear Default Schema Cache

The following command removes the default schema cache:

2 - Clear All Schema Caches

To clear the cache for all GraphQL schemas, run:

This deletes all cached schema files, ensuring any changes made to the schemas are reflected the next time they are accessed.

3 - Clear Cache for a Specific Schema

You can also clear the cache for any other schema by replacing {keyYourSchema} with the desired schema name:

example:

Replace {keyYourSchema} with the actual name of the schema you want to target. This will specifically remove the cache for that schema only.

Endpoint Schemas

Schema 1: Access the GraphQL schema at:

Schema 2: Access the GraphQL schema at:

Schema 3: Access the GraphQL schema at:

Usage

Once configured, you can use the defined routes for each schema in your application. Each route will utilize its corresponding GraphQL schema. You have a multi-schema setup that allows for an unlimited number of access points, each supporting various mutations and queries tailored to your specific needs. You can define each schema according to your project requirements. This flexibility allows you to create distinct schemas for different parts of your application, ensuring that each area can have customized queries and mutations as needed.

Author


All versions of laravel-lighthouse-graphql-multi-schema with dependencies

PHP Build Version
Package Version
Requires php Version ^8
nuwave/lighthouse Version ^6.0
laravel/framework Version ^9.0 || ^10.0 || ^11.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 yakovenko/laravel-lighthouse-graphql-multi-schema contains the following files

Loading the files please wait ....