2017 © Pedro Peláez
 

library chomp

A framework for consumption only REST APIs

image

anich/chomp

A framework for consumption only REST APIs

  • Wednesday, June 8, 2016
  • by ANich
  • Repository
  • 1 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Chomp

Chomp is a Library for extending consumption-only RESTful APIs., (*1)

Build Status, (*2)

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), (*3)

Running Tests

vendor/bin/phpunit tests

or, (*4)

composer test

Contributing

Please see CONTRIBUTING, (*5)

Changelog

Please see CHANGELOG, (*6)

License

This library is licensed under the MIT license. Please see LICENSE, (*7)

The Versions

08/06 2016

dev-master

9999999-dev

A framework for consumption only REST APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Nicholson