Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5707374
Initial rewrite commit
LavaToaster Dec 30, 2015
0fb4ce8
The facade is a facade
LavaToaster Dec 30, 2015
7ce24b4
Refactor OAuthProvider instantiation to PoniverseClient
LavaToaster Dec 31, 2015
6a38b92
Fix variable naming clash in error handlers
LavaToaster Dec 31, 2015
22f2194
Don't throw an exception when updating a user if there's nothing to u…
LavaToaster Dec 31, 2015
49274eb
Updated oauth error response checking
LavaToaster Jan 3, 2016
c351b23
Added Factory, updated demo and added some docblocks.
LavaToaster Jan 3, 2016
ec25cb6
Fixed isset to wrong variable in JsonApiService
LavaToaster Jan 3, 2016
6b98f59
Whoops, forgot to remove the environment setting leftovers.
LavaToaster Jan 3, 2016
ed45f60
Update OAuth2 provider to use production url
LavaToaster Aug 27, 2016
1786d94
Update laravel version constraints
LavaToaster Dec 29, 2016
8f702ba
Corrected the autoloader namespace.
EventideGlow Dec 29, 2016
4eac2f7
Made the project's namespace consistently Poniverse\Lib in all files.
EventideGlow Dec 29, 2016
8942065
Removed PHP 5.4 from Travis's tests.
EventideGlow Dec 29, 2016
0d28ae3
Made the library work against Poniverse API v1.
EventideGlow Dec 29, 2016
851f9ea
Implemented the access token introspection endpoint.
EventideGlow Dec 29, 2016
241c32e
Added support for the account syncing endpoint.
EventideGlow Dec 30, 2016
fe21f03
Support Laravel 5.5
LavaToaster Nov 28, 2017
45d9792
Update php testing matrix
LavaToaster Nov 28, 2017
890eb12
Merge pull request #3 from Lavoaster/patch-1
EventideGlow Nov 29, 2017
54613c5
Merge branch 'master' into rewrite
LavaToaster Feb 14, 2021
ff45a2a
Update supported laravel versions
LavaToaster Feb 14, 2021
ca5fb08
Update dependencies
LavaToaster Feb 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{yml,yaml}]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.phar
composer.lock
.DS_Store
.php_cs.cache
77 changes: 77 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

use Symfony\CS\Config\Config;
use Symfony\CS\FixerInterface;
use Symfony\CS\Finder\DefaultFinder;

$fixers = [
'blankline_after_open_tag',
'braces',
'concat_without_spaces',
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'elseif',
'empty_return',
'encoding',
'eof_ending',
'extra_empty_lines',
'function_call_space',
'function_declaration',
'include',
'indentation',
'join_function',
'line_after_namespace',
'linefeed',
'list_commas',
'logical_not_operators_with_successor_space',
'lowercase_constants',
'lowercase_keywords',
'method_argument_space',
'multiline_array_trailing_comma',
'multiline_spaces_before_semicolon',
'multiple_use',
'namespace_no_leading_whitespace',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'parenthesis',
'phpdoc_indent',
'phpdoc_inline_tag',
'phpdoc_no_access',
'phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'short_array_syntax',
'short_echo_tag',
'short_tag',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_line_after_imports',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trailing_spaces',
'trim_array_spaces',
'unalign_equals',
'unary_operators_spaces',
'unused_use',
'visibility',
'whitespacy_lines',
];

return Config::create()
->finder(DefaultFinder::create()->in(__DIR__))
->fixers($fixers)
->level(FixerInterface::NONE_LEVEL)
->setUsingCache(true);
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- repo: [email protected]:hootsuite/pre-commit-php.git
sha: 1.2.0
hooks:
- id: php-lint
- id: php-unit
- id: php-cs-fixer
args: ['--config-file=.php_cs']
12 changes: 3 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm

matrix:
allow_failures:
- php: hhvm

- 7.0
- 7.1

before_script:
- composer self-update
Expand All @@ -26,4 +20,4 @@ after_script:
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

#Coveralls
- php bin/coveralls -p
- php bin/coveralls -p
36 changes: 6 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,17 @@
Require this package in composer.json and update

"poniverse/api": "dev-master"

### Normal Setup

Example Code:

$config = [
'client_id' => 'YOUR_CLIENT_ID'
'client_secret' => 'YOUR_CLIENT_SECRET'
'host_url' => 'https://api.poniverse.net'
];

$poniverse = new Poniverse(
$config['client_id'],
$config['client_secret'],
new Client([
'base_url' => [$config['host_url'], ['version' => 'v' . Poniverse::VERSION]]
])
);

$poniverse->setAccessToken('GRANTED_ACCESS_TOKEN');

$user = $poniverse->user->get();
// $user['display_name'];
// $user['email'];

### Laravel 4 Setup
### Normal Setup

Open up `app/config/app.php` and add this line in your `providers` section
See `demo\index.php` for an example.

'Poniverse\Api\ApiServiceProvider',
### Laravel 5 Setup

In the same file add this line to the ```aliases``` section
Add the service provider to your `providers` section, usually located in `config/app.php`.

'Poniverse' => 'Poniverse\Api\Facades\Poniverse',
Poniverse\Api\ApiServiceProvider::class,

Publish the configuration and then edit it

php artisan config:publish poniverse/api
php artisan vendor:publish
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.1.*",
"guzzlehttp/guzzle": "4.*"
"php": ">=7.4.0",
"illuminate/support": "^8.0",
"guzzlehttp/guzzle": "^7.0",
"league/oauth2-client": "^2.6"
},
"require-dev": {
"phpunit/phpunit": "4.0.*",
"mockery/mockery": "dev-master",
"satooshi/php-coveralls": "dev-master"
"phpunit/phpunit": "~4.0",
"mockery/mockery": "0.9.*",
"satooshi/php-coveralls": "~1.0"
},
"autoload": {
"psr-0": {
"Poniverse\\Api": "src/"
"psr-4": {
"Poniverse\\Lib\\": "src/"
}
},
"minimum-stability": "stable"
Expand Down
File renamed without changes.
48 changes: 48 additions & 0 deletions demo/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

require '../vendor/autoload.php';

$poniverseClient = new \Poniverse\Lib\Client(
'demo',
'demo',
new GuzzleHttp\Client()
);

// OAUTH DANCE

$oauthProvider = $poniverseClient->getOAuthProvider([
'redirectUri' => 'http://lib.pv/index.php',
]);

try {
// FYI, This is for development use only, you will never be able to
// use the password grant on our production servers.
$accessToken = $oauthProvider->getAccessToken('password', [
'username' => 'test',
'password' => 'test',
]);

$poniverseClient->setAccessToken($accessToken);
} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
dd($e->getMessage());
}

$resourceOwner = $oauthProvider->getResourceOwner($accessToken);

// API TEST

try {
$anotherUser = $poniverseClient->poniverse()->users()->get('5582ba3b-46ab-46f8-95e1-00bb1b8748c7');
} catch (\Poniverse\Lib\Errors\ApiException $e) {
dd($e->getMessage(), $e->getStatusCode());
}

$anotherUser->display_name = 'Test Dummy';

try {
$userService->update($anotherUser);
} catch (\Poniverse\Lib\Errors\ApiException $e) {
// TODO: Handle Error
}

dd($resourceOwner, $anotherUser);
Loading