-
Notifications
You must be signed in to change notification settings - Fork 85
Samples
This sample project is a simple web app that you can explore to understand what each BlockCypher APIs can do for you. Irrespective of how you installed your SDK, you should be able to get the samples running by following the instructions below:
You can view sample source codes here. However, we recommend you run samples locally to get a better idea.
If you are running PHP 5.4 or greater, PHP provides a built-in support for hosting PHP sites.
Note: The root directory for composer based download would be vendor
and for direct download it would be php-client
. Please update the commands accordingly.
-
Run
php -f php-client/blockcypher/php-client/sample/index.php
from your project root directory if you installed the SDK using direct download from releases orphp -f vendor/blockcypher/php-client/sample/index.php
if you installed it using Composer. -
This would host a PHP server at
localhost:5000
. The output should look something like this:<!-- Welcome to BlockCypher REST SDK -- > PHP 5.4.24 Development Server started at Tue May 05 13:44:47 2015 Listening on http://localhost:5000 Document root is D:\project\php-client\blockcypher\php-client\sample Press Ctrl-C to quit.
-
Open http://localhost:5000/ in your web browser, and you should be able to see the sample dashboard.
-
You should see a sample dashboard page as shown below:
The sample comes pre-configured with a test account but in case you need to try them against your account, you must
- Obtain your token from our website
- Update the bootstrap.php file with your new token.
There are two other ways you could run your samples, as shown below:
-
Please note that there are few samples that requires you to have a working local server, to receive callbacks when user creates a new webhook
- To run samples itself on console, you need to open command prompt, and direct to samples directory.
- Execute the sample php script by using
php -f
command as shown below:
php -f chains/GetChain.php
- The result would be as shown below:
If you are looking for a full fledged application that uses the RESTful APIs, check out the Wallet sample app at https://github.com/blockcypher/php-wallet-sample (coming soon!)
Getting Started
Using Our SDK
Configurations
Extras
External Links