Download the PHP package imiphp/project-http without Composer

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

说明

这是一个 imi http 项目开发骨架项目,你可以基于这个项目来开发你的项目。

imi 框架:https://www.imiphp.com

imi 文档:https://doc.imiphp.com

安装

创建项目:composer create-project imiphp/project-http:~2.1.0

如果你希望在 php-fpm、Workerman 运行 imi:已内置

如果你希望在 Swoole 运行 imi:composer require imiphp/imi-swoole:~2.1.0

如果你希望在 RoadRunner 运行 imi:composer require imiphp/imi-roadrunner:~2.1.0

RoadRunner 二进制文件请自行下载!

配置

项目命名空间

默认是 ImiApp,可以在 composer.json 中修改:

然后替换代码中的命名空间即可。

运行配置

项目配置目录:config

HTTP 服务器配置目录:ApiServer/config

启动服务

Swoole:vendor/bin/imi-swoole swoole/start (强烈推荐)

Workerman:vendor/bin/imi-workerman workerman/start (推荐)

RoadRunner:vendor/bin/imi-cli rr/start (尝鲜)

切换环境运行前建议删除运行时文件目录:rm -rf .runtime/*runtime

PHP-FPM:vendor/bin/imi-cli fpm/start(不推荐)

建议在 FPM 模式下生成缓存:vendor/bin/imi-cli imi/buildRuntime --app-namespace "ImiApp" --runtimeMode=Fpm

目录

.runtime 是运行时文件读写目录,需要有可写权限

public 是 php-fpm 站点根目录,不用可删除

rr 是 RoadRunner 模式目录,不用可删除

Module 是模块目录,一种推荐的目录组织方式。每个模块内部有自己的控制器、服务层、模型等。当然,你也可以根据你的喜好自己组织,imi 框架没有强制要求。

内置的示例控制器目录在 Module/Test/ApiController

生产环境

关闭热更新:config/beans.phphotUpdate.status 设为 false

生产环境建议只保留一个容器,可以提升性能,imi 官方推荐使用 Swoole

移除 imi-fpmcomposer remove imiphp/imi-fpm && rm -rf public

移除 imi-workermancomposer remove imiphp/imi-workerman

移除 imi-roadrunnercomposer remove imiphp/imi-roadrunner && rm -rf rr && rm -f .rr.yaml

移除 imi-swoolecomposer remove imiphp/imi-swoole(不推荐)

代码质量

格式化代码

内置 php-cs-fixer,统一代码风格。

配置文件 .php-cs-fixer.php,可根据自己实际需要进行配置,文档:https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/config.rst

格式化项目: ./vendor/bin/php-cs-fixer fix

格式化指定文件: ./vendor/bin/php-cs-fixer fix test.php

代码静态分析

内置 phpstan,可规范代码,排查出一些隐藏问题。

配置文件 phpstan.neon,可根据自己实际需要进行配置,文档:https://phpstan.org/config-reference

分析项目: ./vendor/bin/phpstan

分析指定文件: ./vendor/bin/phpstan test.php

测试用例

内置 phpunit,可以实现自动化测试。

文档:https://phpunit.readthedocs.io/en/9.5/

测试用例 demo:tests/Module/Test/TestServiceTest.php

运行测试用例:composer test


All versions of project-http with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
imiphp/imi Version ~2.1.0
imiphp/imi-fpm Version ~2.1.0
imiphp/imi-workerman Version ~2.1.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 imiphp/project-http contains the following files

Loading the files please wait ....