https://github.com/biscolab/laravel-updown
UpDown.io Laravel 5 package
https://github.com/biscolab/laravel-updown
laravel laravel-5-package laravel-framework php7 updown updown-monitoring
Last synced: 7 months ago
JSON representation
UpDown.io Laravel 5 package
- Host: GitHub
- URL: https://github.com/biscolab/laravel-updown
- Owner: biscolab
- License: mit
- Created: 2019-02-15T16:20:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-28T21:55:11.000Z (over 6 years ago)
- Last Synced: 2025-01-18T09:21:34.725Z (9 months ago)
- Topics: laravel, laravel-5-package, laravel-framework, php7, updown, updown-monitoring
- Language: PHP
- Homepage: https://updown-sdk.biscolab.com/docs/laravel
- Size: 14.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Laravel UpDown
UpDown.io package for Laravel 5[](https://travis-ci.org/biscolab/laravel-updown)
[](https://scrutinizer-ci.com/g/biscolab/laravel-updown/?branch=master)
[](https://scrutinizer-ci.com/g/biscolab/laravel-updown/?branch=master)
[](https://scrutinizer-ci.com/g/biscolab/laravel-updown/build-status/master)
[](https://packagist.org/packages/biscolab/laravel-updown)
[](https://packagist.org/packages/biscolab/laravel-updown)## Installation
You can install the package via composer:
```sh
composer require biscolab/laravel-updown:^1.0
```Laravel 5.5 (or greater) uses package auto-discovery, so doesn't require you to manually add the Service Provider, but if you don't use auto-discovery UpDownServiceProvider must be registered in config/app.php:
The service **provider** must be registered in `config/app.php`:
```php
'providers' => [
...
Biscolab\LaravelUpDown\UpDownServiceProvider::class,
];
```
You can use the facade for shorter code. Add "UpDown" to your aliases:
```php
'aliases' => [
...
'UpDown' => Biscolab\LaravelUpDown\Facades\UpDown::class,
];
```## Configuration
### Add your API Keys
Open .env file and set UPDOWN_API_KEY:
```php
UPDOWN_API_KEY=
```
now refresh Laravel cache```sh
php artisan config:cache
```
You can also create `config/updown.php` configuration file using:
```su
php artisan vendor:publish --provider="Biscolab\LaravelUpDown\UpDownServiceProvider"
```Open `config/updown.php` configuration file and set `api_key` if you do not want to set it in `.env` file:
```php
return [
'api_key' => env('UPDOWN_API_KEY', ''),
];
```Further info about updown.io service [here](https://updown-sdk.biscolab.com/)
## How to use
This package uses `biscolab/updown-php-sdk`. First of all I suggest you to become familiar with that here and with updown.io official documentation
### Helper
```php
updown();
```
`updown()` helper returns an `UpDownBuilder` instance containing yhe UpDown object created with your `UPDOWN_API_KEY### Use objects
To call objects you just have to call the homonymous method:```php
// List all Checks: returns a Checks collection
// Empty Check instance
$checks = updown()->Check()->all();// Check instance initialized with "xxxx" token
$check = updown()->Check("xxxx");// Check instance initialized with $params array
// using Biscolab\UpDown\Fields\CheckFields
$params = [
CheckFields::URL => 'https://insert.your-url.to/check'
];
$check = updown()->Check($params);
```
Further info about `Check` class and all af its methods [here](https://updown-sdk.biscolab.com/docs/check)Follow the same pattern for `Node`, `WebHook`, `Event` objects.
## Test
```sh
composer test
```