承接 anich/chomp 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

anich/chomp

Composer 安装命令:

composer require anich/chomp

包简介

A framework for consumption only REST APIs

README 文档

README

Chomp is a Library for extending consumption-only RESTful APIs.

Build Status

Installation via Composer

$ composer require anich/chomp dev-master

Basic Usage

// YourResource.php
<?php

namespace Your\Namespace;

class YourResource extends \ANich\Chomp\Resource
{
    protected $baseUri = 'http://link/to/your/api.com/api/v1/resources/';
}

// OtherFile.php
<?php

require('vendor/autoload.php');

$chomp = new Chomp;
$resource = $chomp->get('\Your\Namespace\YourResource', '1');

echo $resource->id; // 1
echo $resource->title; // Lorem Title.
echo $resource->body; // Lorem ipsum dolor sit amet, consectetur...

Modifiers

// YourResource.php
<?php

namespace Your\Namespace;

class YourResource extends \ANich\Chomp\Resource
{
    protected $baseUri = 'http://link/to/your/api.com/api/v1/resources/';
    
    public function titleModifier($title);
    {
    	return 'Title: '.$title;
	}
}

// OtherFile.php
<?php

require('vendor/autoload.php');

$chomp = new Chomp;
$resource = $chomp->get('\Your\Namespace\YourResource', '1');

echo $resource->title; // Title: Lorem Title.

(Name your modifiers: fieldModifier)

Running Tests

vendor/bin/phpunit tests

or

composer test

Contributing

Please see CONTRIBUTING

Changelog

Please see CHANGELOG

License

This library is licensed under the MIT license. Please see LICENSE

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-27