承接 jonbaldie/eleven 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jonbaldie/eleven

Composer 安装命令:

composer require jonbaldie/eleven

包简介

A high-performance micro-framework based on workerman.

README 文档

README

CircleCI

Eleven is a high-performance micro-framework for rapidly developing APIs in PHP. It's inspired by passwalls/mark but takes a slightly different approach.

Install

composer require jonbaldie/eleven

Usage

<?php

use Eleven\App;

require 'vendor/autoload.php';

$api = new App('http://0.0.0.0:3000');

$api->count = 4; // process count

$api->any('/', function ($request) {
    return 'Hello world';
});

$api->get('/hello/{name}', function ($request, $name) {
    return "Hello $name";
});

$api->post('/user/create', function ($request) {
    return json_encode(['code' => 200 ,'message' => 'OKAY'], JSON_PRETTY_PRINT);
});

$api->start();

Run command php start.php start -d

Going to http://127.0.0.1:3000/hello/world will now display "Hello world".

Available commands

# To restart the worker threads:
php start.php restart -d

# To stop the worker threads:
php start.php stop

# To get a pretty status table:
php start.php status

# To see a list of active connections:
php start.php connections

Docker

I've used this package in thecodingmachine's excellent PHP images:

docker run -it -p 3000:3000 -e PHP_EXTENSION_REDIS=1 -v (pwd):/usr/src/app thecodingmachine/php:8.1-v4-cli bash

root@a6a4143b05cb:/usr/src/app# php start.php start -d
Workerman[start.php] start in DAEMON mode
----------------------------------------- WORKERMAN -----------------------------------------
Workerman version:4.0.26          PHP version:8.1.1
------------------------------------------ WORKERS ------------------------------------------
proto   user            worker          listen                 processes    status
tcp     root            none            http://0.0.0.0:3000    4             [OK]
---------------------------------------------------------------------------------------------
Input "php start.php stop" to stop. Start success.

Caveats

Storing your application in memory is a great way to get a massive speed boost and unbelievable resource efficiency.

But if you don't manage your application's state well, then you will start to see weird issues from data in one session leaking into another session.

This is why I try to avoid shared state and the use of static variables in PHP. These are very convenient when trying to rapidly build a project, but they will bite you in the rear at a later date, usually when you are least prepared for it!

One of the biggest pain points is user session data. Try using cookies or a remote store such as Redis to make sure that your worker threads are all singing from the same hymn sheet and to keep your application as stateless as possible.

You will write your best code when following the concept of a pure, deterministic state in your application, even if you don't subscribe fully to the paradigm of functional programming.

I love functional programming and think it is a great way to keep your code testable and maintainable - I even created a separate PHP skeleton project around those principles.

Roadmap

  • Basic functionality
  • Composer package published
  • Test suite set up
  • Static analysis set up
  • CircleCI configuration
  • v1.0.0 release

jonbaldie/eleven 适用场景与选型建议

jonbaldie/eleven 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-04