forked from alienzin/php-eos-rpc-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit that includes the first GET method.
- Loading branch information
0 parents
commit ee44e01
Showing
20 changed files
with
3,714 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
RPC_NODE_URL=https://eosapi.blockmatrix.network/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
vendor | ||
.DS_Store | ||
.idea/ | ||
.env | ||
.php_cs.cache | ||
tests/coverage | ||
tests/static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@PSR2' => true, | ||
'no_leading_import_slash' => true, | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'no_singleline_whitespace_before_semicolons' => true, | ||
'no_unused_imports' => true, | ||
'concat_space' => ['spacing' => 'one'], | ||
'no_whitespace_in_blank_line' => true, | ||
'ordered_imports' => true, | ||
'single_quote' => true, | ||
'no_empty_statement' => true, | ||
'no_extra_consecutive_blank_lines' => true, | ||
'phpdoc_no_package' => true, | ||
'phpdoc_scalar' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'whitespace_after_comma_in_array' => true, | ||
'function_typehint_space' => true, | ||
'hash_to_slash_comment' => true, | ||
'lowercase_cast' => true, | ||
'no_leading_namespace_whitespace' => true, | ||
'native_function_casing' => true, | ||
'no_short_bool_cast' => true, | ||
'no_unneeded_control_parentheses' => true, | ||
'ternary_to_null_coalescing' => true, | ||
'visibility_required' => true, | ||
'cast_spaces' => true, | ||
'phpdoc_add_missing_param_annotation' => true, | ||
'phpdoc_align' => true, | ||
'phpdoc_indent' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_single_line_var_spacing' => true, | ||
'no_empty_phpdoc' => true, | ||
'trailing_comma_in_multiline_array' => true, | ||
'binary_operator_spaces' => ['align_double_arrow' => true], | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__ . '/src') | ||
->in(__DIR__ . '/tests') | ||
) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# The PHP SDK for the EOS RPC API | ||
|
||
This is is a work in progress, the intention is to wrap the Chain API in a PHP SDK. | ||
|
||
## Background | ||
|
||
You can check out the [official docs](https://eosio.github.io/eos/group__eosiorpc.html). | ||
|
||
## Installing | ||
|
||
```php | ||
composer require BlockMatrixNetwork/php-eos-rpc-sdk | ||
``` | ||
|
||
## Configuration | ||
|
||
Update the dot env `.env` with your favourite RPC API host. | ||
|
||
## Usage | ||
|
||
There is a shiny factory method to auto instantiate all dependencies: | ||
|
||
```php | ||
$api = (new ChainFactory)->api(); | ||
``` | ||
|
||
So far there is 1 lonely method: | ||
|
||
### Get Info | ||
|
||
```php | ||
echo $api->getInfo(); | ||
|
||
{ | ||
"server_version": "db031363", | ||
"chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", | ||
"head_block_num": 1380988, | ||
"last_irreversible_block_num": 1380657, | ||
"last_irreversible_block_id": "0015113163cbe7676c4e56d1758a1ce95e47fa645827b9202de5753031d36b8b", | ||
"head_block_id": "0015127c94676db3da55ec66210952db7f4db35b0e731abefff1562c201a0666", | ||
"head_block_time": "2018-06-18T15:38:45.000", | ||
"head_block_producer": "eoscannonchn", | ||
"virtual_block_cpu_limit": 200000000, | ||
"virtual_block_net_limit": 1048576000, | ||
"block_cpu_limit": 199900, | ||
"block_net_limit": 1048576 | ||
} | ||
``` | ||
|
||
## Tests | ||
|
||
Project has 100% test coverage, because OCD. | ||
|
||
To run the test suites, simply execute: | ||
|
||
```php | ||
vendor/bin/phpunit | ||
``` | ||
|
||
If you wanna get fancy and check code coverage: | ||
|
||
```php | ||
vendor/bin/phpunit --coverage-html tests/coverage | ||
``` | ||
|
||
If you're really bored, you might wanna run some static analysis: | ||
|
||
```php | ||
vendor/bin/phpmetrics --report-html="tests/static" . | ||
``` | ||
|
||
## Contributing | ||
|
||
All contributions are welcome! Just fire up a PR and pinky swear the code passes the tests, has new tests | ||
written to maintain 100% coverage and make sure its PSR-2 compliant: | ||
|
||
```php | ||
vendor/bin/php-cs-fixer fix --verbose | ||
``` | ||
|
||
## License | ||
|
||
Free for everyone! | ||
|
||
MIT License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "BlockMatrixNetwork/php-eos-rpc-sdk", | ||
"description": "PHP SDK for the EOS RPC API", | ||
"type": "library", | ||
"keywords": ["php","eos","rpc","sdk","api","crypto","blockchain","ghostbusters"], | ||
"homepage": "https://github.com/BlockMatrixNetwork/php-eos-rpc-sdk", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Pete Cheyne", | ||
"email": "pete@blockmatrix.network", | ||
"role": "Chaos Monkey" | ||
} | ||
], | ||
"require": { | ||
"guzzlehttp/guzzle": "~6.0", | ||
"vlucas/phpdotenv": "^2.4" | ||
}, | ||
"require-dev": { | ||
"mockery/mockery": "0.9.*", | ||
"phpunit/phpunit": "~5.0", | ||
"phpspec/phpspec": "~2.1", | ||
"friendsofphp/php-cs-fixer": "^2.3", | ||
"phpmetrics/phpmetrics": "^2.2" | ||
}, | ||
"autoload": { | ||
"psr-4": {"BlockMatrix\\EosRpc\\": ["src/"]} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": {"BlockMatrix\\EosRpc\\": ["tests/"]} | ||
}, | ||
"scripts": { | ||
"post-root-package-install": [ | ||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" | ||
] | ||
} | ||
} |
Oops, something went wrong.