Download the PHP package meshell/surf without Composer

On this page you can find all versions of the php package meshell/surf. 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 surf

Surf

Build Status Coverage Status Maintainability

surf 是一个对Swoole扩展库的封装,它可以像传统MVC一样编写 Http,Tcp 应用.

Installation

使用Composer来安装框架.

Usage

一个简单的http应用,创建一个配置文件config.php.

创建一个http.php文件.

启动服务.

浏览器打开http://127.0.0.1:9527/ 显示 "Hello world", 你也可以使用curl.

查看事例http

一个简单的tcp应用, 配置文件还是使用上面的config.php, 创建一个tcp.php. tcp需要设置protocol解析类. 一般tcp服务端和客户端使需要约定消息格式才能解析出正确的数据. 在surf中我们使用的默认解析格式是包头,包长,包体(unpack(A64header/Nlen/A*data))作为消息格式。调用每条协议我们是定义在包头中.

编写客户端程序client.php.

启动服务

连接服务

打印服务返回内容: "my name is meShell, my age is 18, My job is an engineer";

查看事例tcp

Connection pool

surf中使用连接池功能.

在启动文件里注册provider.

Controller中获取连接池中的对象.

查看事例pool

Usage Session and Cookie

sessioncookieweb开发中是经常需要使用的保存一些登录信息, 登录状态等等.

匿名函数中使用. 在回调函数时候框架会自动将路由变量, request, cookies 这几个参数填充到函数.

HttpController中使用.

查看事例session

任务

在控制器中使用$this->task(), 这个是异步, 想使用同步可以$this->syncTask().

查看事例task

全局定时器

在有些业务中我们可能会有这样的需求,比如每隔两小时需要读取下订单数.但你也可以用crontab实现. 相同时间的定时器会被最后一次添加的定时器覆盖,定时器时间单位为毫秒.

查看事例ticker

License

LICENSE


All versions of surf with dependencies

PHP Build Version
Package Version
Requires php Version >=7
ext-swoole Version ~2.0
nikic/fast-route Version ^1.2
pimple/pimple Version ^3.0
symfony/event-dispatcher Version ^4.0
zendframework/zend-diactoros Version ^1.7
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 meshell/surf contains the following files

Loading the files please wait ....