定制 optimus/onion 二次开发

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

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

optimus/onion

最新稳定版本:1.0.0

Composer 安装命令:

composer require optimus/onion

包简介

无描述信息

README 文档

README

Build Status Coverage Status

A standalone middleware library without dependencies inspired by middleware in Laravel (Illuminate/Pipeline).

I have written a small blog post about the library and how to use it: Implementing before/after middleware in PHP

Installation

composer require optimus/onion ~1.0

Usage

class BeforeLayer implements LayerInterface { public function peel($object, Closure $next) { $object->runs[] = 'before'; return $next($object); } } class AfterLayer implements LayerInterface { public function peel($object, Closure $next) { $response = $next($object); $object->runs[] = 'after'; return $response; } } $object = new StdClass; $object->runs = []; $onion = new Onion; $end = $onion->layer([ new AfterLayer(), new BeforeLayer(), new AfterLayer(), new BeforeLayer() ]) ->peel($object, function($object){ $object->runs[] = 'core'; return $object; }); var_dump($end);

Will output

..object(stdClass)#161 (1) { ["runs"]=> array(5) { [0]=> string(6) "before" [1]=> string(6) "before" [2]=> string(4) "core" [3]=> string(5) "after" [4]=> string(5) "after" } } 

统计信息

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

GitHub 信息

  • Stars: 72
  • Watchers: 4
  • Forks: 18
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固