Download the PHP package deinternetjongens/lighthouse-utils without Composer

On this page you can find all versions of the php package deinternetjongens/lighthouse-utils. 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 lighthouse-utils

Lighthouse Utils (no longer maintained)

Build Status Code Coverage Scrutinizer Code Quality Latest Unstable Version

This package can generate queries for the Lighthouse GraphQL library. This is not a standalone package, so Lighthouse is listed as a dependency.

To generate queries, all you need to do is define a couple of GraphQL Types and run the generate command. Scroll down to 'Schema' to learn more.

We also include a couple of Directives and Scalar types. More about that later on.

Installation

Install via composer

Alternatively, you can try the example installation below.

Example installation

An example installation is available at: https://github.com/maarten00/lighthouse-utils-example

Register Service Provider

Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.

Add service provider to config/app.php in providers section

Register Facade

Register package facade in config/app.php in aliases section

Publish Configuration File

Contributing

Before committing, please run ./automate.sh

This script will run all code style checks and phpunit tests. Fix all errors before opening a pull request.

Usage

This package uses Laravel Auto Discovery to register itself with your application. It exposes a GraphQL interface interface on the /graphql route.

To get started, run the following command in your Laravel application:

A config file will be generated: config/lighthouse.php. You can change these values if you want.

Schema generation

Define your GraphQL schema by adding Types, Queries and Mutations in app/GraphQL/Types, app/GraphQL/Queries and app/GraphQL/Mutations directories. If you want to change these paths, publish the config file for this package and change the paths there.

Currently this package only supports custom Types, Queries and Mutations are ignored. You can define your custom types and run the command below to auto-generate queries and mutations for those types. In the future it will be possible to add custom queries and mutations to the above directories. These will then also be used in the generated schema.

For more information on schemas and basic Lighthouse usage, check the Lighthouse docs

To generate your schema.graphql file, run the following command:

The schema will be generated to the path as defined in the Lighthouse config, lighthouse.schema.register

Custom Queries and Mutations

It might happen that you need a custom query or mutation beside the generated schema. In this package you have the ability to add custom queries and mutations by creating .graphql files in the default directories app/GraphQL/Queries and app/GraphQL/Mutations (These directories are adjustable by editing the config/lighthouse.php file)

Take for example a custom query to retrieve an instance of a model:

This query will be parsed after running the schema generation command and will be added to the Query section of the schema.graphql

Scalar types

Currently two scalar types are included. More about scalar type usage can be found here.

Date

A date string with format Y-m-d. Example: "2018-01-01"

scalar Date @scalar(class: "DeInternetJongens\\LighthouseUtils\\Schema\\Scalars\\Date")

DateTimeTZ

A date string with format Y-m-d H:i:s+P. Example: "2018-01-01 13:00:00+00:00"

scalar DateTimeTz @scalar(class: "DeInternetJongens\\LighthouseUtils\\Schema\\Scalars\\DateTimeTz")

PostalCodeNl

A postal code as valid for The Netherlands, format 1111aa. Example: "7311SZ"

Email

An RFC 5321 compliant e-mail

FullTextSearch

Indicates that a field searches through multiple fields. To use this scalar, you need to add a scope on your model scopeFullTextSearch. Example:

In the scope you can basically define whatever kind of query you want.

Directives

To run more advanced queries, a couple of directives are included. These are automatically registered with Lighthouse, so you can use them at your own discretion.

Currently these directives are included:

Migrations

This package stores the generated schema in the database, so the schema is available outside the schema.graphql and can be used to sync permission. Publish the migration and migrate the database.

Authorization

To protect your queries and migrations from unauthorized users, you can enable the Authorization feature. To enable authorization, make sure you have published the config for this package and add the following line to your .env file:

LIGHTHOUSE_UTILS_AUTHORIZATION=true

When a schema is generated the event DeInternetJongens\LighthouseUtils\Events\GraphQLSchemaGenerated will be fired. In your application you can listen for this event to sync the generated permissions with your application. The event has a schema variable with the generated schema.

The generated queries and their corresponding permissions will also be persisted to your database to the graphql_schema table. An Eloquent model for this table is included with this package.


All versions of lighthouse-utils with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
illuminate/auth Version ^5.4
illuminate/database Version ^5.4
illuminate/support Version ^5.4
nuwave/lighthouse Version ^2.2
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 deinternetjongens/lighthouse-utils contains the following files

Loading the files please wait ....