2017 © Pedro Peláez
 

library factom-api

A simple Laravel service provider for the Factom API.

image

adrianmejias/factom-api

A simple Laravel service provider for the Factom API.

  • Friday, September 22, 2017
  • by adrianmejias
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Factom API for Laravel

Latest Version Software License Build Status Quality Score StyleCI Total Downloads, (*1)

This package provides a simple service provider for the Factom API for use with the Laravel Framework., (*2)

Factom API documentation: https://docs.factom.com/api, (*3)

Note: This package is under development and should not be used for production environments., (*4)

Installation

You can install this package via composer using:, (*5)

composer require adrianmejias/factom-api

You must also install this service provider in conifg/app.php., (*6)

'providers' => [
  ...

  AdrianMejias\FactomApi\FactomApiServiceProvider::class,

  ...

The package will automatically register itself. If not, then add the alias in config/app.php., (*7)

'aliases' => [
  ...

  'FactomApi' => AdrianMejias\FactomApi\Facades\FactomApi::class,
  'FactomWalletApi' => AdrianMejias\FactomApi\Facades\FactomWalletApi::class,
  'FactomDebugApi' => AdrianMejias\FactomApi\Facades\FactomDebugApi::class,

  ...

To publish the config file to app/config/factom-api.php, (*8)

php artisan vendor:publish --provider="AdrianMejias\FactomApi\FactomApiServiceProvider"

This will publish a file factom-api.php in your config directory with teh following content:, (*9)

<?php

return [

  /**
   * Base credentials for Factom server.
   */
  'url' => env('FACTOM_URL', 'http://localhost:8088/v2'),

  'ssl' => [
    'enable' => env('FACTOM_SSL', false),
    'certificate' => env('FACTOM_CERTIFICATE', storage_path('app/factomdAPIpub.cert')),
  ],

  'username' => env('FACTOM_USERNAME'),

  'password' => env('FACTOM_PASSWORD'),

  /**
   * Factom wallet server credentials.
   */
  'wallet' => [
    'url' => env('FACTOM_WALLET_URL', 'http://localhost:8089/v2'),

    'ssl' => [
      'enable' => env('FACTOM_WALLET_SSL', false),
      'certificate' => env('FACTOM_WALLET_CERTIFICATE', storage_path('app/factomdAPIpub.cert')),
    ],

    'username' => env('FACTOM_WALLET_USERNAME'),

    'password' => env('FACTOM_WALLET_PASSWORD'),
  ],

  /**
   * Factom debug server credentials.
   */
  'debug' => [
    'url' => env('FACTOM_DEBUG_URL', 'http://localhost:8088/debug'),

    'ssl' => [
      'enable' => env('FACTOM_DEBUG_SSL', false),
      'certificate' => env('FACTOM_DEBUG_CERTIFICATE', storage_path('app/factomdAPIpub.cert')),
    ],

    'username' => env('FACTOM_DEBUG_USERNAME'),

    'password' => env('FACTOM_DEBUG_PASSWORD'),
  ],

];

Usage

After you've installed the package and filled in the values in the config-file working with this pacakge will be a breeze. All the following examples use the facade., (*10)

Route::get('/factom/heights', function() {
  $result = FactomApi::heights();

  return response()->json($result);
});

Todo

  • ~~Replace Curl with Guzzle~~
  • ~~Add Wallet methods~~
  • Add certificate auth
  • Add unit tests

Testing

Run the tests with:, (*11)

vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details., (*12)

Security

If you discover any security related issues, please email adrianmejias@gmail.com instead of using the issue tracker., (*13)

Credits

License

The MIT License (MIT). Please see License File for more information., (*14)

The Versions

22/09 2017

dev-master

9999999-dev https://github.com/adrianmejias/factom-api

A simple Laravel service provider for the Factom API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api php factom factomd factom-walletd factom-debug

22/09 2017

v1.4

1.4.0.0 https://github.com/adrianmejias/factom-api

A simple Laravel service provider for the Factom API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api php factom factomd factom-walletd factom-debug

21/09 2017

v1.3

1.3.0.0 https://github.com/adrianmejias/factom-api

A simple Laravel service provider for the Factom API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api php factom factomd factom-walletd factom-debug

20/09 2017

v1.2

1.2.0.0 https://github.com/adrianmejias/factom-api

A simple Laravel service provider for the Factom API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api php factom factomd factom-walletd factom-debug

20/09 2017

v1.1

1.1.0.0 https://github.com/adrianmejias/factom-api

A simple Laravel service provider for the Factom API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api php factom factomd factom-walletd factom-debug

20/09 2017

v1.0

1.0.0.0 https://github.com/adrianmejias/factom-api

A simple Laravel service provider for the Factom API.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api php factom factomd factom-walletd factom-debug