Download the PHP package brianbrian666/tp-transformer without Composer

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

tp-transformer

ThinkPHP 5–8 的 API 数据转换与 JSON 响应工具,基于 League Fractal。可以把单条数据、集合或 ThinkPHP 分页结果交给 Transformer,统一生成响应。

安装

本包不锁定 ThinkPHP 主版本;请按所用 ThinkPHP 版本安装其要求的 PHP 版本。PHP 最低版本为 5.6,ThinkPHP 6–8 自身通常要求更高版本。

使用

Transformer 按 Fractal 约定实现 transform():

在控制器中直接使用工厂:

工厂方法也接受 Transformer 实例:

返回值是 ThinkPHP 的 think\Response JSON 响应,可直接从控制器返回。noContent() 生成 204 响应,error($message, $statusCode) 用于生成指定状态码的 JSON 响应。分页 URL 会按请求的页码逐页生成。

ThinkPHP 5–8 兼容说明

分页适配器不对 ThinkPHP 的分页类或 ORM 集合类做硬编码类型约束,兼容各版本提供的 getCollection() / items()、currentPage() / getCurrentPage() 等分页接口。响应通过 ThinkPHP 的 think\Response::create() 创建。建议在目标项目的 ThinkPHP 版本中验证控制器返回响应及分页 URL 配置。

灵感来源

本项目的过滤器式 API 调用灵感来自 Tucker-Eric/EloquentFilter;本包实现的是 ThinkPHP 下基于 Fractal 的数据转换与响应功能。

License

MIT


All versions of tp-transformer with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
league/fractal Version ^0.19.2
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 brianbrian666/tp-transformer contains the following files

Loading the files please wait ...