Giter Club home page Giter Club logo

platform's Introduction

Utopia Platform

Build Status Total Downloads Discord

An object oriented way of writing Applications using Utopia libraries

Getting Started

This library contains abstract classes that assist in implementing services and actions for Utopia http framework and CLI. You must implement Platform, Service and Action classes to build your application.

Example

Install using composer

composer require utopia-php/platform

Implementing a HTTP services using platform.

// Action

<?php

use Utopia\Platform\Action;

class HelloWorldAction extends Action
{
    public function __construct()
    {
        $this->httpPath = '/hello';
        $this->httpMethod = 'GET';
        $this->inject('response');
        $this->callback(fn ($response) => $this->action($response));
    }

    public function action($response)
    {
        $response->send('Hello World!');
    }
}

// service

use Utopia\Platform\Service;

class HelloWorldService extends Service
{
    public function __construct()
    {
        $this->type = Service::TYPE_HTTP;
        $this->addAction('hello', new HelloWorldAction());
    }
}

// Platform

use Utopia\Platform\Platform;

class HelloWorldPlatform extends Platform
{
    public function __construct()
    {
        $this->addService('helloService', new HelloWorldService());
    }
}

// Using platform to initialize http service

$platform = new HelloWorldPlatform();
$platform->init('http');

System Requirements

Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.

Contributing

All code contributions - including those of people having commit access - must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code.

We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.

Copyright and license

The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php

platform's People

Contributors

abnegate avatar christyjacob4 avatar eldadfux avatar lohanidamodar avatar meldiron avatar omjikush09 avatar shimonewman avatar vermakhushboo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.