From 9b960768945ce368a8856f0f7adb5ad67265d5e7 Mon Sep 17 00:00:00 2001 From: Jeffrey Hyer Date: Wed, 11 Oct 2017 11:31:27 -0600 Subject: [PATCH] v0.1.0 --- LICENSE.md | 19 ++++++++++++ README.md | 70 ++++++++++++++++++++++++++++++++++++++++++ composer.json | 39 +++++++++++++++++++++++ src/Facade.php | 13 ++++++++ src/ServiceProvder.php | 41 +++++++++++++++++++++++++ 5 files changed, 182 insertions(+) create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 composer.json create mode 100644 src/Facade.php create mode 100644 src/ServiceProvder.php diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..eb6cb3c --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (C) 2017 Jeffrey Hyer + +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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5ffdaa2 --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +# BambooHR for Laravel 5 + +> __NOTE__: This package currently requires PHP >= 7.0.0 +> +> If you have a need for PHP 5.x support let me know by opening an issue +> (or feel free to submit a pull request). + +## Installation + +```bash +$ composer require jeffreyhyer/bamboohr-laravel +``` + +#### Laravel 5.5+ +This package supports auto-discovery of the Service Provder +and Facade, you can skip to the __Configuration__ section below. + +#### Laravel <= 5.4 +For Laravel <= 5.4 you'll need to add the Service Provider and Facade to the +`config/app.php` file. + +```php + [ + // ... + JeffreyHyer\BambooHR\ServiceProvider::class, +], + +'aliases' => [ + // ... + 'Bugsnag' => JeffreyHyer\BambooHR\Facade::class, +], +``` + +## Configuration + +In order to access the BambooHR API you'll need to configure your company's +subdomain and provide an API key. + +Add the following to the `config/services.php` file: + +```php +'bamboohr' => [ + 'domain' => env('BAMBOOHR_DOMAIN'), + 'key' => env('BAMBOOHR_APIKEY'), +], +``` + +If you decide to use the `.env` file to store the domain and API Key (recommended) +you'll need to add the following to your `.env` file: + +```bash +BAMBOOHR_DOMAIN=company # Company Subdomain (e.g. http://COMPANY.bamboohr.com/) +BAMBOOHR_APIKEY=0123456789abcdef # API Key +``` + +## Usage + +Once installed you should be able to access the BambooHR API through the facade: + +```php +directory(); +``` + +For full API documentation and additional usage options see +[https://jeffreyhyer.github.io/bamboohr/](https://jeffreyhyer.github.io/bamboohr/) \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..8cd6b78 --- /dev/null +++ b/composer.json @@ -0,0 +1,39 @@ +{ + "name": "jeffreyhyer/bamboohr-laravel", + "type": "library", + "description": "Laravel 5.x Service Provider and Facade for the jeffreyhyer/bamboohr package", + "keywords": ["laravel", "bamboohr", "api"], + "version": "0.1.0", + "require": { + "php": ">=7.0.0", + "illuminate/support": "5.0.* || 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.*", + "jeffreyhyer/bamboohr": "^0.1.2" + }, + "license": "MIT", + "authors": [ + { + "name": "Jeffrey Hyer", + "email": "jmhyer135@gmail.com" + } + ], + "homepage": "https://github.com/jeffreyhyer/bamboohr-laravel", + "support": { + "issues": "https://github.com/jeffreyhyer/bamboohr-laravel/issues", + "source": "https://github.com/jeffreyhyer/bamboohr-laravel" + }, + "autoload": { + "psr-4": { + "JeffreyHyer\\BambooHR\\": "src/" + } + }, + "extra": { + "laravel": { + "providers": [ + "JeffreyHyer\\BambooHR\\ServiceProvider" + ], + "aliases": { + "BambooHR": "JeffreyHyer\\BambooHR\\Facade" + } + } + } +} diff --git a/src/Facade.php b/src/Facade.php new file mode 100644 index 0000000..3a4eaa1 --- /dev/null +++ b/src/Facade.php @@ -0,0 +1,13 @@ +app->singleton(BambooHR::class, function ($app) { + $domain = $app['config']->get('services.bamboohr.domain', ""); + $api_key = $app['config']->get('services.bamboohr.key', ""); + + return new BambooHR($domain, $api_key); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [BambooHR::class]; + } +} \ No newline at end of file