Yo
Just Yo API wrapper for fun :), (*1)
, (*2)
Installation
This library can be found on Packagist.
The recommended way to install this is through composer., (*3)
Run these commands to install composer, the library and its dependencies:, (*4)
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar require toin0u/yo:@stable
Or edit composer.json
and add:, (*5)
{
"require": {
"toin0u/yo": "@stable"
}
}
Protip: you should browse the
toin0u/yo
page to choose a stable version to use, avoid the @stable
meta constraint., (*6)
API
This package uses the awesome Ivory Http Adapter which supports
plenty adapters. We will use the
CurlHttpAdapter
for our examples., (*7)
Following methods throw a \RuntimeException
if something goes wrong during the API calls., (*8)
<?php
require 'vendor/autoload.php';
use Ivory\HttpAdapter\CurlHttpAdapter;
use Yo\Yo;
$yo = new Yo(new CurlHttpAdapter, 'you_api_token');
// ...
You can find your API token in your Yo dashboard., (*9)
Following API examples will use the Yo
instance created previously:, (*10)
/yo/
// ...
$yo->user('foobar'); // Yo FOOBAR
$yo->user('foobar', new \Yo\Bag\Link('http://sbin.dk/')); // Yo FOOBAR with a link
$yo->user('foobar', new \Yo\Bag\Location(55.699953, 12.552736)); // Yo FOOBAR with a location
This method returns true
on success false
otherwise., (*11)
Read more, (*12)
/yoall/
// ...
$yo->all(); // Yo your subscribers
$yo->all(new \Yo\Bag\Link('http://sbin.dk/')); // Yo your subscribers with a link
This method returns nothing. Please note The API allows only one Yo once per minute., (*13)
Read more, (*14)
/accounts/
// ...
$yo->create('barbaz', 'newpassword');
Please note that you can provide a callback url, an email, a description and a boolean
to tell if the account requires location or not., (*15)
Read more, (*16)
/check_username/
// ...
$yo->exists('foobar'); // checks if FOOBAR exsists or not.
This method returns true
on success false
otherwise., (*17)
Read more, (*18)
/subscribers_count/
// ...
echo $yo->total(); // get total number of subscribers
Read more, (*19)
Specification tests
Install PHPSpec globally
with composer and run it in the project., (*20)
$ composer global require phpspec/phpspec:@stable
$ phpspec run -fpretty
Contributing
Please see CONTRIBUTING for details., (*21)
Support
Please open an issues in github, (*22)
Contributor Code of Conduct
As contributors and maintainers of this project, we pledge to respect all people
who contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities., (*23)
We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, age, or religion., (*24)
Examples of unacceptable behavior by participants include the use of sexual
language or imagery, derogatory comments or personal attacks, trolling, public
or private harassment, insults, or other unprofessional conduct., (*25)
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct. Project maintainers who do not follow the
Code of Conduct may be removed from the project team., (*26)
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by opening an issue or contacting one or more of the project
maintainers., (*27)
This Code of Conduct is adapted from the Contributor
Covenant, version 1.0.0, available at
http://contributor-covenant.org/version/1/0/0/, (*28)
License
This Yo package is released under the MIT License. See the bundled
LICENSE file for details., (*29)