Download the PHP package jasonmccallister/hasura without Composer

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

Hasura

Use your Craft CMS credentials to authenticate with a GraphQL API powered by Hasura.io

Requirements

This plugin requires Craft CMS 3.5.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
  2. Then tell Composer to load the plugin:

    composer require jasonmccallister/hasura
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Hasura.

Hasura Overview

Hasura.io is an open-source tool that makes building APIs with real-time GraphQL APIs without writing any code. Hasura lets you connect to a new, or existing, PostgreSQL database and automatically build a GraphQL schema with real-time subscriptions; all with out writing any code!

This allows you to build GraphQL APIs at scale, with no code, using only a database and Docker image!

Watch this video as the Hasura team takes a complex applications database (in the example it uses the Gitlab database) and drops it into GraphQL in under 4 minutes

Instant GraphQL on GitLab

Out of the box, Hasura comes with:

  1. Automatic Schema generation including nested relationships
  2. GraphQL queries & mutations based on your database
  3. Subscription support allowing realtime UI updates
  4. Remote schemas allowing you to combine multiple GraphQL APIs
  5. Migrations for new projects
  6. Event trigger based on database actions (insert, updates, and deletes)
  7. Dynamic access roles and authentication

However, Hasura can be configured to accept JWTs that are signed in a specific format. This is where the Hasura plugin helps. This plugin allows you to use your Craft CMS users and groups to generate the JWT to send to your Hasura API.

Configuring Hasura

After installation, you need to set a few items in the plugins settings:

  1. Enable or disable CSRF (if external applications will use this endpoint for JWTs you need to disable CSRF)
  2. Set the signing method on the JWT that the Hasura API expects (RS256 or etc)
  3. Enter the key (string or private token)

Using Craft CMS as Authentication for Hasura

Users will authenticate with their username (or email if Craft is configured for email) and password to

https://yourdomain.com/hasura/auth

Example Response

Example JWT

Configuring Craft CMS to Handle Event Trigger Webhooks from Hasura

Hasura allows you to tie events to table actions like insert, update, and delete. These are known as Event Triggers. This plugin allows you to receive those event triggers by configuring Hasura to send to your Craft CMS.

https://yourdomain.com/hasura/webhook

You can configure the header that Hasura will send in the plugin settings as well as a key. When the event trigger payload is received, the plugin will fire the hasuraEventTrigger event and allow you to listen for the event and take action.

The event contains the following:

Brought to you by Jason McCallister

Add Custom Claims via Twig field in Plugin Settings

You can add custom claims (for example the users name or a custom field) to the JWT token via the new Custom Claims field in the Plugin settings. You can add any additional information as well as user specific details as he field accepts the user variable. In Hasura you are then able to write rules based on the x-hasura-custom-claim object.

Example twig query

Example JWT

Current limitation for custom claim arrays

As Hasura only accepts custom claims to be strings we need to unwrap arrays and add them as single claims. The plugin does this for you but only on the first level. Recursive mapping will be added later. More infos can be found here: https://github.com/hasura/graphql-engine/issues/1902

Example twig query returning an object/array

Example JWT


All versions of hasura with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3.5.0
firebase/php-jwt Version ^5.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 jasonmccallister/hasura contains the following files

Loading the files please wait ....