定制 cspray/labrador 二次开发

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

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

cspray/labrador

最新稳定版本:3.2.1

Composer 安装命令:

composer require cspray/labrador

包简介

Core functionality powering Labrador Kennel Applications through Plugins, Events, and Engines

README 文档

README

PHP Unit Testing & Code Lint GitHub release GitHub license

An opinionated, asynchronous micro-framework written on top of amphp. Built using SOLID principles, unit testing, and a modular ecosystem Labrador aims to be a production-ready framework for creating asynchronous PHP applications. Labrador Core serves as the foundation for this framework and provides important key concepts for building apps with Labrador.

Installation

Composer is the only supported method for installing Labrador packages.

composer require cspray/labrador

Quick Start

If you'd rather get started quickly without having to read a bunch of documentation the code below demonstrates how to quickly get an Application implemented and running. Otherwise, we recommend checking out the Documentation for more detailed information, and a complete guide to getting started.

<?php

// app.php in your project's root directory

require_once __DIR__ . '/vendor/autoload.php';

use Cspray\Labrador\AbstractApplication;
use Cspray\Labrador\EnvironmentType;
use Cspray\Labrador\CoreApplicationObjectGraph;
use Cspray\Labrador\Engine;
use Cspray\Labrador\StandardEnvironment;
use Amp\Promise;
use Amp\Delayed;
use Amp\Log\StreamHandler;
use Auryn\Injector;
use Monolog\Logger;
use function Amp\call;
use function Amp\ByteStream\getStdout;

class HelloWorldApplicationObjectGraph extends CoreApplicationObjectGraph {

    public function wireObjectGraph() : Injector {
        $injector = parent::wireObjectGraph();

        // wire up your app's dependencies

        return $injector;
    }

}

class HelloWorldApplication extends AbstractApplication {

    protected function doStart() : Promise {
        return call(function() {
            yield new Delayed(500);  // just to show that we are running on the Loop
            $this->logger->info('Hello Labrador!');
        }); 
    }

}

$environment = new StandardEnvironment(EnvironmentType::Development());
$logger = new Logger('labrador.hello-world', [new StreamHandler(getStdout())]);

$injector = (new HelloWorldApplicationObjectGraph($environment, $logger))->wireObjectGraph();

$app = $injector->make(HelloWorldApplication::class);
$engine = $injector->make(Engine::class);

$engine->run($app);

Documentation

Labrador packages have thorough documentation in-repo in the docs/ directory. You can also check out the documentation online at https://labrador-kennel.io/docs/core.

Governance

All Labrador packages adhere to the rules laid out in the Labrador Governance repo

统计信息

  • 总下载量: 505
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固