Download the PHP package compwright/graphql-php-scalars without Composer

On this page you can find all versions of the php package compwright/graphql-php-scalars. 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 graphql-php-scalars

graphql-php-scalars

A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php

Validate GitHub license Packagist Packagist

This is a fork of mll-labs/graphql-php-scalars that supports PHP 7.4 and eliminates several unnecessary third party dependencies. As a result, email validation will be slightly stricter (we rely on the built-in PHP filter_var()).

Installation

composer require compwright/graphql-php-scalars

Usage

You can use the provided Scalars just like any other type in your schema definition. Check SchemaUsageTest for an example.

If using the SDL, you can use the included ScalarDirectiveDecorator to load your desired custom scalar class and attach it to a custom scalar type.

You'll need this in your schema:

Then when loading the schema, pass an instance of ScalarDirectiveDecorator as the $typeConfigDecorator argument to BuildSchema::build():

If multiple decorators are needed to implement various other things, they could be pipelined together using something like https://github.com/thephpleague/pipeline.

BigInt

An arbitrarily long sequence of digits that represents a big integer.

Date

A date string with format Y-m-d, e.g. 2011-05-23.

The following conversion applies to all date scalars:

DateTime

A datetime string with format Y-m-d H:i:s, e.g. 2018-05-23 13:43:32.

DateTimeTz

A datetime string with format Y-m-d\TH:i:s.uP, e.g. 2020-04-20T16:20:04+04:00, 2020-04-20T16:20:04Z.

Email

A RFC 5321 compliant email.

JSON

Arbitrary data encoded in JavaScript Object Notation. See https://www.json.org.

This expects a string in JSON format, not a GraphQL literal.

JSON responses will contain nested JSON strings.

Mixed

Loose type that allows any value. Be careful when passing in large Int or Float literals, as they may not be parsed correctly on the server side. Use String literals if you are dealing with really large numbers to be on the safe side.

Null

Always null. Strictly validates value is non-null, no coercion.

Regex

The Regex class allows you to define a custom scalar that validates that the given value matches a regular expression.

The quickest way to define a custom scalar is the make factory method. Just provide a name and a regular expression, you will receive a ready-to-use custom regex scalar.

You may also define your regex scalar as a class.

StringScalar

The StringScalar encapsulates all the boilerplate associated with creating a string-based Scalar type. It performs basic checks and coercion, you can focus on the minimal logic that is specific to your use case.

All you have to specify is a function that checks if the given string is valid. Use the factory method make to generate an instance on the fly.

Or you may simply extend the class, check out the implementation of the Email scalar to see how.


All versions of graphql-php-scalars with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8
ext-json Version *
psr/container Version ^1.1 || ^2
psr/log Version ^1.1 || ^2 || ^3
webonyx/graphql-php Version ^15.9
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 compwright/graphql-php-scalars contains the following files

Loading the files please wait ...