Download the PHP package autumn/autumn-framework without Composer
On this page you can find all versions of the php package autumn/autumn-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package autumn-framework
Autumn Framework
Autumn Framework is a micro service framework based on PECL/Swoole.
Autumn Framework是基于PECL/Swoole的微服务框架。
Getting Started
1.Import:
1.导入:
2.Add your own namespace to composer.json (eg: Market):
2.在composer.json中加入自定义的项目名称空间(如:Market):
3.Create index.php:
3.编写index.php:
4.Create model class (Plain Ordinary PHP Object, POPO):
4.创建模型类(简单的常规PHP类):
Notice: we use mintware-de/json-object-mapper as default JSON object mapper since 0.1.0, and json_encode()
as fallback mapper.
注意:自0.1.0开始,我们使用mintware-de/json-object-mapper作为默认的JSON对象序列化及反序列化工具。无法使用该代码包时(例如版权问题),框架使用json_encode()
函数作为备选。
5.Create controller class (POPO):
5.创建控制器类(POPO):
Respond 10 cars when requesting "GET /cars".
接收"GET /cars"并响应10辆车的信息。
6.Launch service:
6.启动微服务:
7.Enjoy:
Define a bean and inject it into a property (since 0.1.0)
1.Create configuration class and define beans:
1.创建Configuration类,定义Bean:
2.Inject the bean to a property:
2.注入到类属性上:
Use @Autowired
annotation on methods (since 0.2.0):
Retrieve request body (since 0.2.0)
Add @RequestBody
annotation to action method:
在动作方法上为某个参数定义@RequestBody
注解:
Notice: string
is the only supported type by @RequestBody
annotation.
注意:目前仅支持string
类型的变量。
Do something after all beans are loaded (since 0.2.0):
Create derivative of interface ContextRefreshedEventApplicationListener
:
创建接口ContextRefreshedEventApplicationListener
的派生类:
Connect to MySQL server in coroutine (since 0.2.0):
1.Define bean of MySqlOperations
:
1.定义MySqlOperations
接口的Bean:
2.Inject to a class and use it:
2.注入类并使用:
Notice: We strongly suggest to use this feature in actions of controllers.
注意:这项特性目前仅建议使用在控制器的动作方法中。
Additional changes
0.2.0
- Interface
FactoryBean
. - Access log.
- Add placeholder
{xxx}
support to log messages. - 日志中支持
{xxx}
占位符; - Show trace info when exceptions were caught.
- 捕捉到异常时展示堆栈调用;
DbalTemplate
(require packageDoctrine/DBAL
).
Extra Dependencies
See
- Autumn Example
- Double-Array Trie Server
- Spring
- Spring in Action
All versions of autumn-framework with dependencies
ext-swoole Version >=1.7.7
doctrine/annotations Version ^1.4
psr/log Version ^1.0
mintware-de/json-object-mapper Version ^1.2
bulton-fr/dependency-tree Version ^1.1
doctrine/dbal Version ^2.5