Download the PHP package nash/pin without Composer

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

Pin, by Nash

Pin 是一款零配置、无骨架、极小化的 Hyperf 发行版,它的灵感来源于 hyperf/nano

设计思路

Hyperf 是一款十分优秀的基于 Swoole 或 Swow 的框架,但是对于初学者来说,可能稍微有些复杂了,nano 则为初学者使用 Hyperf 提供了极大的便利。但其对开发者依然存在一定的基础素质要求,某些场景的使用即使是老手也要愣一下神。于是,为了贯彻 nano 的设计理念,从而自行设计了本项目,真正实现忽略框架细节,专注业务代码的理念。

特性

安装

快速开始

hello world 服务

在项目根目录打开命令行,执行以下命令

您已经开启了一个可以输出 hello world 的 HTTP 服务,在浏览器打开 http://127.0.0.1:9501 就可以看到您的项目在跟这个世界问好。

定义自己的服务

在项目根目录创建文件 index.php ,内容如下:

然后,在项目根目录打开命令行,执行以下命令

你的服务依然开起来了,在浏览器打开 http://127.0.0.1:9501 就可以看到您的项目再次跟这个世界问好。

可以看到,相比 nano ,pin 显得更为简洁,简洁到创建应用和启动应用的步骤也给您省略掉了,您只需要去定义你的服务拥有哪些业务接口,拥有哪些执行流程即可。

路由

pin 和 nano 一样,支持 Hyperf 路由器的所有方法

HyperfaddGroup 方法在此处被定义为 group 方法,addRoute 方法在此处被定义为 route 方法。

中间件

路由定义的方法中,第三个参数以及之后的所有参数均作为路由中间件被使用,这与 Hypernano 有些许的不同,因为 middleware 这个单词太长了,而且在 Hyperf 中几乎就没有其他的可配置项了。

另外,中间件的方法入参也从原本的两个参数更换成一个回调方法的入参了,Hyperf 中间件的第一个参数 Psr\Http\Message\ServerRequestInterface $request 容易和控制器的 Hyperf\HttpServer\Contract\RequestInterface $request 混淆,这里也是我当初愣神的地方,因此,干脆将这个对象去掉了,将两个请求对象的操作差异抹平即可,所以也就不需要服务请求参数了。

DI容器

请求类使用 \Nash\Pin\Server\Request 的实例来操作,它抹平了 Psr\Http\Message\ServerRequestInterfaceHyperf\HttpServer\Contract\RequestInterface 的差异,因此,它既可以在路由方法中使用,也可以在中间件中使用。

所以系统提供的类都可以使用 instance 静态方法来获取,也可以通过 Container 实例的 get 方法获取,你甚至可以完全使用单例模式惯用的操作来获取实例。

因为支持这种模式,所以也就不支持像 nano 那样将回调方法绑定到 Hyperf\Nano\ContainerProxy 的操作,我总觉得这样对 IDE 不够友好。

命令行

异常处理

事件监听

自定义进程

定时任务

使用协程服务端

使用Swow

框架默认使用 Swoole 引擎,如果没有安装 Swoole 扩展,则会降级使用 Swow, 此时,只需要安装Swow兼容层(官方的Swow兼容在使用UDP协议服务时,存在BUG,正在与官方沟通解决)即可:

监听其他协议

同时监听多个服务端口


All versions of pin with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
hyperf/command Version ~3.0.0
hyperf/config Version ~3.0.0
hyperf/context Version ~3.0.16
hyperf/contract Version ~3.0.0
hyperf/di Version ~3.0.0
hyperf/framework Version ~3.0.0
hyperf/http-server Version ~3.0.0
hyperf/stringable Version ~3.0.0
hyperf/support Version ~3.0.0
hyperf/tappable Version ~3.0.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 nash/pin contains the following files

Loading the files please wait ....