A PHP GraphQL Framework
Switch branches/tags
Nothing to show
Clone or download

README.md

Railt

Travis CI Code coverage Scrutinizer CI Latest Stable Version Latest Unstable Version License MIT

Not ready for real world usage yet 💣 😱

Introduction

This is a pure PHP realization of the GraphQL protocol based on the webonyx/graphql-php implementations of the official GraphQL Specification located on Facebook GitHub.

The difference from the above implementations is that the Railt provides the ability to describe the types and extended control of their behavior, thereby solving problems such as:

  • Simplifying type declarations
  • Types reusage
  • Significant simplification of the construction of the API
  • More flexible integration with frameworks (e.g. Laravel or Symfony)
  • And others

Quick start

The documentation is in the process of writing, therefore, in order to understand how it works, a quick start.

schema.graphqls

This is our main GraphQL application schema.

schema {
    query: Example
}

type Example {
    say(message: String = "Hello"): String! 
        @route(action: "ExampleController@say")
}

ExampleController.php

The GraphQL request query { say } handler indicated in the @route directive

class ExampleController
{
    public function say(string $message): string
    {
        return $message;
    }
}

index.php

This is the main file that handles all requests to the application. With the same success this role can be performed by any controller in the MVP (MVC with passive models) application, for example on the basis of a Symfony or Laravel.

<?php

use Railt\Io\File;
use Railt\Http\Factory;
use Railt\Discovery\Discovery;
use Railt\Foundation\Application;
use Railt\Foundation\Config\Composer;


$loader = require __DIR__ . '/vendor/autoload.php';

//
// Create and configure an application
//
$app = new Application(true);
$app->configure(new Composer(Discovery::fromClassLoader($loader)));

//
// GraphQL SDL application schema
// 
$schema = File::fromPathname(__DIR__ . '/schema.graphqls');

//
// 1) Send all Requests to our connection
// 2) Send the Response back to the client
//
Factory::createFromGlobals()
    ->request($app->connect($schema))
    ->debug($app->isDebug())
    ->send();

Response:

{
    "say": "Something is awesome!"
}

Learning Railt

This documentation can contain NOT RELEVANT information and currently in progress.

Contributing

Thank you for considering contributing to the Railt Framework! The contribution guide can be found in the documentation.

Security Vulnerabilities

If you discover a security vulnerability within Railt, please send an e-mail to maintainer at nesk@xakep.ru. All security vulnerabilities will be promptly addressed.

License

The Railt Framework is open-sourced software licensed under the MIT license.

The Railt\Compiler, which is part of the Railt Framework re-distribute under the BSD-3-Clause license.

FOSSA Status

Development Status

Packages Release CI Status
railt/railt Latest Stable Version Travis CI
railt/discovery Latest Stable Version Travis CI
railt/laravel-provider Latest Stable Version Travis CI
railt/symfony-bundle Latest Stable Version Travis CI
railt/carbon-extension Latest Stable Version Travis CI
Components Release CI Status
railt/compiler Latest Stable Version Travis CI
railt/container Latest Stable Version Travis CI
railt/http Latest Stable Version Travis CI
railt/io Latest Stable Version Travis CI
railt/reflection Latest Stable Version Travis CI
railt/sdl Latest Stable Version Travis CI
railt/storage Latest Stable Version Travis CI
railt/graphql-ast Latest Stable Version Travis CI
railt/lexer Latest Stable Version Travis CI
railt/parser Latest Stable Version Travis CI

Supported By

JetBrains Rambler&Co