-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 510a24b
Showing
7 changed files
with
162 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Optimist Digital <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,32 @@ | ||
# Laravel Healthz | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/optimistdigital/laravel-healthz.svg?style=flat-square)](https://packagist.org/packages/optimistdigital/laravel-healthz) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/optimistdigital/laravel-healthz.svg?style=flat-square)](https://packagist.org/packages/optimistdigital/laravel-healthz) | ||
|
||
Healthz is a Composer package that adds a health check route to the [Laravel](https://laravel.com) application. | ||
|
||
Creates a route with path `/healthz` that response with 200 status code. | ||
|
||
## Usage | ||
|
||
In `routes/web.php` add a line: | ||
|
||
``` | ||
Healthz::endpoint(); | ||
``` | ||
|
||
## Installation | ||
|
||
Install the package in a Laravel project via Composer: | ||
|
||
``` | ||
composer require optimistdigital/laravel-healthz | ||
``` | ||
|
||
## Credits | ||
|
||
- [Allan Tatter](https://github.com/allantatter) | ||
|
||
## License | ||
|
||
Laravel Healthz is open-sourced software licensed under the [MIT license](LICENSE.md). |
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,34 @@ | ||
{ | ||
"name": "optimistdigital/laravel-healthz", | ||
"description": "Health check route for Laravel application.", | ||
"keywords": [ | ||
"laravel", | ||
"healthcheck", | ||
"healthz", | ||
"optimistdigital" | ||
], | ||
"license": "MIT", | ||
"require": { | ||
"laravel/framework": "^6.0 || ^7.0 || ^8.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"OptimistDigital\\LaravelHealthz\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"OptimistDigital\\LaravelHealthz\\ServiceProvider" | ||
], | ||
"aliases": { | ||
"Healthz": "OptimistDigital\\LaravelHealthz\\Facade" | ||
} | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace OptimistDigital\LaravelHealthz; | ||
|
||
class Facade extends \Illuminate\Support\Facades\Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'healthz'; | ||
} | ||
|
||
/** | ||
* Register the healthz endpoint | ||
* | ||
* @param array $options | ||
* @return void | ||
*/ | ||
public static function endpoint(array $options = []) | ||
{ | ||
static::$app->make('router')->healthz($options); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace OptimistDigital\LaravelHealthz; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
|
||
class HealthzController extends BaseController | ||
{ | ||
public function healthz() | ||
{ | ||
return response('/healthz'); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace OptimistDigital\LaravelHealthz; | ||
|
||
class HealthzRouteMethods | ||
{ | ||
public function healthz() | ||
{ | ||
return function ($options = []) { | ||
$this->get('healthz', 'OptimistDigital\LaravelHealthz\HealthzController@healthz')->name('healthz'); | ||
}; | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
namespace OptimistDigital\LaravelHealthz; | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
class ServiceProvider extends \Illuminate\Support\ServiceProvider | ||
{ | ||
/** | ||
* Register any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
} | ||
|
||
/** | ||
* Perform post-registration booting of services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
Route::mixin(new HealthzRouteMethods); | ||
} | ||
} |