Skip to content

Commit 016b81e

Browse files
committed
Initial commit
0 parents  commit 016b81e

File tree

7 files changed

+199
-0
lines changed

7 files changed

+199
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/src/node_modules
2+
/src/public/storage
3+
/vendor
4+
.env
5+
*~
6+
/.idea
7+
/.DS_Store
8+
/composer.lock

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Cas de Reuver
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# monday-api-laravel
2+
3+
This Laravel package is a wrapper for [tblack-it/monday-api](https://github.com/tblack-it/monday-api).
4+
5+
## Install
6+
7+
Via Composer
8+
9+
``` bash
10+
$ composer require proclame/monday-api-laravel
11+
```
12+
This package uses autodiscovery, so you don't have to manually add anything to your config/app.php.
13+
14+
### In case you do not use autodiscovery:
15+
16+
Add the ServiceProvider and the Facade to your `config/app.php`:
17+
18+
```php
19+
'providers' => [
20+
...
21+
Proclame\Monday\MondayServiceProvider::class,
22+
],
23+
'aliases' => [
24+
...
25+
'Monday' => Proclame\Monday\MondayFacade::class,
26+
]
27+
```
28+
29+
*OPTIONAL* Then run the following command to publish the config to your config/ directory.
30+
It should be enough to add MONDAY_TOKEN=MYTOKEN to your .env file.
31+
32+
```bash
33+
$ php artisan vendor:publish --tag=config
34+
```
35+
36+
```php
37+
return [
38+
'monday_token' => 'MYTOKEN', // the token for your tenant on monday.com
39+
];
40+
```
41+
42+
## Usage
43+
44+
``` php
45+
$all_boards = Monday::getBoards();
46+
```
47+
48+
For more usage information, see [tblack-it/monday-api](https://github.com/tblack-it/monday-api)
49+
50+
## Credits
51+
52+
- [Nick Mispoulier][link-author] <[email protected]>
53+
54+
## License
55+
56+
The MIT License (MIT). Please see [License File](LICENSE) for more information.
57+
58+
[link-author]: https://github.com/proclame

composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "proclame/monday-api-laravel",
3+
"homepage": "https://github.com/proclame/monday-api-laravel",
4+
"description": "Laravel wrapper around the monday-api package from tblack-it",
5+
"license": "MIT",
6+
"keywords": [
7+
"laravel",
8+
"monday"
9+
],
10+
"authors": [
11+
{
12+
"name": "Nick Mispoulier",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"require": {
17+
"php": ">=7.2.0",
18+
"tblack-it/monday-api": ">=0.2.0",
19+
"laravel/framework": ">=5.5"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"Proclame\\Monday\\": "src"
24+
}
25+
},
26+
"extra": {
27+
"laravel": {
28+
"providers": [
29+
"Proclame\\Monday\\MondayServiceProvider"
30+
],
31+
"aliases": {
32+
"Monday": "Proclame\\Monday\\MondayFacade"
33+
}
34+
}
35+
}
36+
}

config/monday.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'monday_token' => env('MONDAY_TOKEN'), // the token for your tenant on monday.com
5+
];

src/MondayFacade.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
namespace Proclame\Monday;
3+
4+
use Illuminate\Support\Facades\Facade as IlluminateFacade;
5+
6+
class MondayFacade extends IlluminateFacade
7+
{
8+
protected static function getFacadeAccessor()
9+
{
10+
return 'monday';
11+
}
12+
public static function __callStatic($method, $args)
13+
{
14+
$instance = static::getFacadeRoot();
15+
switch (count($args)) {
16+
case 0:
17+
return $instance->$method();
18+
19+
case 1:
20+
return $instance->$method($args[0]);
21+
22+
case 2:
23+
return $instance->$method($args[0], $args[1]);
24+
25+
case 3:
26+
return $instance->$method($args[0], $args[1], $args[2]);
27+
28+
case 4:
29+
return $instance->$method($args[0], $args[1], $args[2], $args[3]);
30+
31+
default:
32+
return call_user_func_array(array($instance, $method), $args);
33+
}
34+
}
35+
}

src/MondayServiceProvider.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Proclame\Monday;
4+
5+
use Proclame\Monday\Monday;
6+
use TBlack\MondayAPI\Token;
7+
use Proclame\Monday\Connection;
8+
use TBlack\MondayAPI\MondayBoard;
9+
use Illuminate\Support\ServiceProvider;
10+
11+
class MondayServiceProvider extends ServiceProvider
12+
{
13+
public function boot()
14+
{
15+
$this->publishes([
16+
__DIR__.'/../config/monday.php' => config_path('monday.php')
17+
], 'config');
18+
}
19+
20+
public function register()
21+
{
22+
$this->mergeConfigFrom(__DIR__.'/../config/monday.php', 'monday');
23+
24+
$this->app->bind('monday', function ($app) {
25+
$mondayBoard = new MondayBoard();
26+
$mondayBoard->setToken(new Token(config('monday.monday_token')));
27+
28+
return $mondayBoard;
29+
});
30+
}
31+
32+
public function provides()
33+
{
34+
return ['monday'];
35+
}
36+
}

0 commit comments

Comments
 (0)