定制 madewithlove/glue 二次开发

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

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

madewithlove/glue

Composer 安装命令:

composer require madewithlove/glue

包简介

Glue is a package to quickly bootstrap packages-based applications

README 文档

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

What's Glue?

Glue is an adhesive substance used for sticking objects or materials together ( ͡° ͜ʖ ͡°)

Glue is also an helper package made to quickly bootstrap packages-based applications. At its core it's just a container and a quick PSR7 setup, on top of which are glued together service providers and middlewares.

This is not a microframework (in the sense that it doesn't frame your work). If this is what you're looking for I recommend instead using Silex, Slim or whatever you want. On the contrary, Glue is as its name indicates just a bit of glue to tie existing packages and middlewares together. It doesn't assume much, it won't get in your way, it's just a way to tie stuff together.

What does it look like

To be concise, Glue turns a common setup such as the following (container + router + PSR7):

<?php
// Create container
$container = new Container();
$container->addServiceProvider(SomeProvider::class);
$container->addServiceProvider(AnotherProvider::class);

// Create router and routes
$router = new RouteCollection($container);
$router->get('/', 'SomeController::index');

// Create PSR7 middleware handler
$relay = (new RelayBuilder())->newInstance([
    SomeMiddleware::class,
    function($request, $response, $next) use ($router) {
        $next($request, $router->dispatch($request, $response));
    },
]);

// Create PSR7 stack
$request = ServerRequestFactory::fromGlobals();
$response = $relay(new Request, new Response());

(new SapiEmitter())->emit($response);

Into this:

$app = (new Glue())
    ->setServiceProviders([
        new SomeServiceProvider(),
        new AnotherServiceProvider(),
        new LeagueRouteServiceProvider(),
    ])
    ->setMiddlewares([
        SomeMiddleware::class,
        LeagueRouteMiddleware::class,
    ]);

// Decorates a router of your choice
$app->get('/', 'SomeController::index');

$app->run();

In order to be truly flexible, Glue accepts any PSR11 compatible container, and register its services through the service-provider standard.

As you can see Glue serves two purposes: eliminating recurring boilerplate in binding packages together, and providing service providers for common packages such as league/route. It is configurable and flexible, it won't get in your way, it's just here to help you not type the same things over and over again.

What's in the box

Glue provides several service providers out of the box:

  • Routing

    • Base routing system with league/route
    • PSR7 stack with zendframework/zend-diactoros
    • View engine with twig/twig
    • Facultative base controller
  • Business

    • Database handling with illuminate/database
    • Migrations with robmorgan/phinx
    • Command bus with league/tactician
  • Development

    • Dotenv files with vlucas/phpdotenv
    • Logs handling with monolog/monolog
    • Debugbar with maximebf/debugbar
    • Small CLI with symfony/console
    • Filesystem with league/flysystem
    • REPL with psy/psysh

Any of these can be overidden or removed; this package doesn't enforce any structure or the use of any dependency in particular.

Why? Because I do a lot of very small web applications, for myself or public ones, and I was tired of going through the same routine for the hundreth time. Then I thought others might have the same use case and here we are.

Install

$ composer require madewithlove/glue

Usage

See the documentation for more informations.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email heroes@madewithlove.be instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

madewithlove/glue 适用场景与选型建议

madewithlove/glue 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 71 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「container」 「packages」 「psr7」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 madewithlove/glue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 madewithlove/glue 我们能提供哪些服务?
定制开发 / 二次开发

基于 madewithlove/glue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 71
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-21