-
Notifications
You must be signed in to change notification settings - Fork 4
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
Jeffrey Hyer
committed
Oct 11, 2017
0 parents
commit 9b96076
Showing
5 changed files
with
182 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,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. |
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,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 | ||
<?php | ||
|
||
'providers' => [ | ||
// ... | ||
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 | ||
<?php | ||
|
||
// Get employee directory | ||
BambooHR::employees->directory(); | ||
``` | ||
|
||
For full API documentation and additional usage options see | ||
[https://jeffreyhyer.github.io/bamboohr/](https://jeffreyhyer.github.io/bamboohr/) |
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,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" | ||
} | ||
} | ||
} | ||
} |
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 JeffreyHyer\BambooHR; | ||
|
||
class Facade extends \Illuminate\Support\Facades\Facade | ||
{ | ||
|
||
protected static function getFacadeAccessor() | ||
{ | ||
return 'bamboohr'; | ||
} | ||
|
||
} |
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,41 @@ | ||
<?php | ||
|
||
namespace JeffreyHyer\BambooHR; | ||
|
||
use BambooHR\BambooHR; | ||
|
||
class ServiceProvider extends \Illuminate\Support\ServiceProvider | ||
{ | ||
|
||
/** | ||
* Indicates if loading of the provider is deferred. | ||
* | ||
* @var bool | ||
*/ | ||
protected $defer = true; | ||
|
||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->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]; | ||
} | ||
} |