定制 utopia-php/platform 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

utopia-php/platform

最新稳定版本:0.9.0

Composer 安装命令:

composer require utopia-php/platform

包简介

Light and Fast Platform Library

README 文档

README

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

统计信息

  • 总下载量: 106.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 3
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 6
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固