hyperized / hostfact
Hostfact 3.0 API Implementation for Laravel
Installs: 6 529
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 7
Forks: 15
Open Issues: 0
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.5
- hyperized/value-objects: ^0.3.0
- thecodingmachine/safe: ^2.4
Requires (Dev)
- infection/infection: ^0.26.16
- orchestra/testbench: ^7.15
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
- povils/phpmnd: ^3.0
- squizlabs/php_codesniffer: ^3.7
- vimeo/psalm: ^5.1
This package is auto-updated.
Last update: 2024-11-06 18:24:10 UTC
README
Official documentation:
Installation
Install using composer:
composer require hyperized/hostfact
This package supports Package Auto-Discovery (Laravel 5.5+) so it doesn't require you to manually add the ServiceProvider and alias.
If you are using a lower version of Laravel or not using Auto-Discovery you can add the Hostfact Service Provider to
the config/app.php
file
Hyperized\Hostfact\HostfactServiceProvider::class,
Register an alias for Hostfact, also in config/app.php
:
'Hostfact' => Hyperized\Hostfact\HostfactServiceProvider::class,
Now publish the Hostfact package into your installation:
php artisan vendor:publish --provider="Hyperized\Hostfact\HostfactServiceProvider" --tag="config"
This should give you a message
like: Copied File [/vendor/hyperized/hostfact/config/Hostfact.php] To [/config/Hostfact.php]
It's possible to edit your configuration variables in the config/Hostfact.php
file or you can use the HOSTFACT_URL
and HOSTFACT_KEY
environment variables to store sensitive information in the .env
file
// config/Hostfact.php 'api_v2_url' => env('HOSTFACT_URL', 'https://yoursite.tld/Pro/apiv2/api.php'), 'api_v2_key' => env('HOSTFACT_KEY', 'token'), 'api_v2_timeout' => env('HOSTFACT_TIMEOUT', 20), // .env/.env.example HOSTFACT_URL=https://yoursite.tld/Pro/apiv2/api.php HOSTFACT_KEY=token HOSTFACT_TIMEOUT=20
Functionality
When writing code for this Hostfact package, consider that this package has been written as a basic interface.
This package will do the following:
- Provide an easy way to communicate with Hostfact API controllers;
- Document the available API controller endpoints with methods;
- Transport layer (HTTP/HTTPS) error catching;
- Basic error parsing;
This package will not:
- Parameter / input validation;
- Output validation;
You will need to consult the Hostfact API documentation to understand the acceptable input and output for each of the API controllers.
Examples
Example code:
use \Hyperized\Hostfact\Api\Controllers\Product; $products = Product::new() ->list([ 'searchfor' => 'invoice' ]);