Coder Social home page Coder Social logo

libgraviton / graviton Goto Github PK

View Code? Open in Web Editor NEW
13.0 18.0 10.0 11.12 MB

A Symfony based framework to generate REST services from JSON service definition files.

Home Page: https://docs.graviton.scbs.ch

License: MIT License

PHP 98.08% Shell 0.02% Twig 1.89%

graviton's Introduction

Graviton

CI Coverage Status Packagist Version Packagist Downloads Packagist License

Graviton is a Symfony and Doctrine Mongo ODM based REST server generation toolkit. So it stores all data in MongoDB.

You can define your REST service in an simple JSON format, run the generator - and voilà - your REST API is ready to go.

Let's say you define this file:

{
  "id": "Example",
  "service": {
    "readOnly": false,
    "routerBase": "/example/endpoint/"
  },
  "target": {
    "fields": [
      {
        "name": "id",
        "type": "string"
      },
      {
        "name": "data",
        "type": "string"
      }
    ]
  }
}

Then you run the generator

php bin/console graviton:generate:dynamicbundles

And once running, you will have a full RESTful endpoint at /example/endpoint, supporting GET, POST, PUT, DELETE and PATCH as well as a valid generated JSON schema endpoint, pagination headers (Link as github does it) and much more.

The generated code are static PHP files and configuration for the Serializer and Symfony and is regarded as disposable. You can always regenerate it - don't touch the generated code.

The application is highly optimized for runtime performance, particurarly in the context of PHP-FPM with activated opcache.

It boasts many additional features (such as special validators and many flags and configurations) which are currently mostly undocumented as this project was not built for public usage in mind. But if there is interest and support from outside users, we welcome questions and contributions.

Install

composer install

Usage

./dev-cleanstart.sh

and

php bin/console

Documentation

There are some general docs on interacting with the codebase as a whole.

Some even broader scoped docs in a seperate repo.

The bundle readme files which show how to interact with the various subsystems.

And not to forget, the all important CHANGELOG.

Tracing

This component comes with a tracing bundle, but it is deactivated by default. To enable it, one must set this ENVs:

TRACING_ENABLED=true

This enables the bundle. Then you need to set the jaeger-bundle specific envs:

AUXMONEY_OPENTRACING_AGENT_HOST=zipkin-hostname # hostname to jaeger
AUXMONEY_OPENTRACING_AGENT_PORT=6831 # port to jaeger
AUXMONEY_OPENTRACING_SAMPLER_VALUE=true # const sampler value (sends always if true or never if false)

See this and this page about the 2 bundles.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.