Download the PHP package wonder-game/es-utility without Composer

On this page you can find all versions of the php package wonder-game/es-utility. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package es-utility

简介

基于Easyswoole封装的一些Trait和Class,放到Composer仓库以实现多项目共用一套代码

开始

composer require wonder-game/es-utility

需要掌握的基础知识:

目录结构及常用介绍

src 理解为EasySwoole的App目录
 ├── Common  主要放一些非EasySwoole的东
 |      ├── Classes 自定义类
 │      │     ├── Crontab 实现定时任务的类(后面会移动至Crontab目录)
 │      │     ├── CtxRequest 协程单例类,解决一些痛点,如Model内无法获取Http Request、WebSocket Caller实例等,作用与EasySwoole\Component\Context\ContextManager类似
 │      │     ├── DateUtils 时间日期时区等处理
 │      │     ├── ExceptionTrigger 自定义异常处理器,将异常上报至redis或http
 │      │     ├── FdManager  WebSocket连接符管理,共享内存(Swoole\Table)实现
 │      │     ├── LamJwt jwt
 │      │     ├── LamOpenssl RSA数据加密和解密
 │      │     ├── LamUnit 辅助工具类
 │      │     ├── Mysqli 对MysqlClient的二次封装
 │      │     ├── ShardTable 定时建分区、续分区
 │      │     ├── Tree 数行结构处理
 │      │     └── XlsWriter 数据导入和导出
 │      ├── Exception 各种自定义异常
 │      ├── Http Http相关的配置
 │      │     └── Code Http响应状态码,项目的Code请`继承`它
 │      ├── Language I18N国际化目录
 │      │     ├── Dictionary 国际化字典,项目请`继承`它
 │      │     └── Languages I18n助手类,主要用来注册、设置
 │      │
 │      ├── Logs 自定义日志处理器
 │      └── OrmCache 模型缓存组件,已实现 String、Hash、Set、SplArray
 │
 ├── HttpController
 │        ├── Admin
 │        │     ├── BaseTrait 继承BaseController
 │        │     ├── AuthTrait 继承BaseTrait引用类,是其他控制器的父类,主要实现一些CURD等基础操作,子类可写最少代码实现相关功能
 │        │     └── ... 其他业务控制器
 │        ├── Api
 │        └── BaseController 所有控制器的基类
 ├── HttpTracker 链路追踪
 │        ├── Index 继承自PointContext,目的是为了默认开启autoSave及设置saveHandler,实例化时用它替代PointContext
 │        └── SaveHandler 实现SaveHandlerInterface接口
 ├── Model
 │     ├── BaseModelTrait 所有Model的基类
 │     └── ... 其他业务模型
 ├── Task 异步任务
 │     ├── Crontab 通用的异步任务模板
 │     └── ... 异步任务类
 ├── WebSocket 同 HttpController
 ├── ... 其他业务
 ├── EventInitialize 对EasySwooleEvent::initialize事件的一些封装
 ├── EventMainServerCreate  对EasySwooleEvent::mainServerCreate事件的一些封装
 └── function.php 常用函数,项目可预定义对应函数以实现不同逻辑

Controller

Model

答疑解惑

function.php 为何不写在此项目的composer.json

function.php应该由项目的composer.json去定义引入的顺序
位置一定得是在项目的函数引入之后,否则无法预定义函数,而放在此项目的composer.json会被优先加载

为何多数文件选择trait而不使用继承

trait和继承各有优劣,选择trait目的是为了EasySwoole推荐的继承关系不被破坏

trait有哪些坑

1. 不允许重写属性,所以基本都定义了一个setTraitProtected方法去修改trait属性
2. 不允许重载方法,当某些项目可能比方法多一个小逻辑时,需要及时调整代码的封装,否则需要整个复制多一份,日积月累,反而可能更难维护
3. 由于 2 的限制,现将普通控制器方法的public方法名默认添加一个固定前缀,通过基础控制器 /src/HttpController/BaseControllerTrait.php 的 actionNotFound 方法来实现更加灵活的调用方式

开发备忘

1. OrmCache/Strings的bloom功能使用时需注意:如果不同的系统(例如log, sdk)刚好用的是同一个redis实例,而且又刚好有同名的表(例如game,package),请务必保证两表内容是同步的!!像pay.order_GAMEID分表和log.order_GAMEID分表,这个得注意了,因为它俩就是主键和内容都不同的,不能启用这个功能!!!

TODO

其他

感谢

JetBrains Logo (Main) logo.

Star History

Star History Chart


All versions of es-utility with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
easyswoole/jwt Version >=1.1
easyswoole/config Version >=1.0
easyswoole/easyswoole Version 3.4.x
easyswoole/redis-pool Version >=2.1
easyswoole/orm Version >=1.4
easyswoole/mysqli Version >=2.2
easyswoole/task Version >=1.1
easyswoole/log Version >=1.0
easyswoole/i18n Version ^1.0
easyswoole/policy Version ^1.0
easyswoole/file-watcher Version ^1.0
easyswoole/tracker Version ^1.1
easyswoole/swoole-ide-helper Version ^1.3
easyswoole/words-match Version ^1.1
easyswoole/wechat Version ^2.0
ext-json Version *
ext-iconv Version *
ext-mbstring Version *
easyswoole/http-client Version ^1.5
alibabacloud/dm-20151123 Version ^1.1
tencentcloud/ses Version ^3.0
easyswoole/oss Version ^1.1
alibabacloud/dysmsapi-20170525 Version ^2.0
tencentcloud/sms Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wonder-game/es-utility contains the following files

Loading the files please wait ....