diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index f5e2ecb..b17230e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -10,12 +10,17 @@ jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + php: ['7.0', '7.1', '7.2', '7.3', '7.4'] steps: - uses: actions/checkout@v2 - - name: install - run: composer install + - name: Set up + uses: nanasess/setup-php@master + - run: composer install --prefer-dist --no-progress --no-suggest - - name: test + - name: Test run: composer test && composer cs diff --git a/.gitignore b/.gitignore index c5bfe86..cc49f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor -composer.lock \ No newline at end of file +composer.lock +.phpunit* \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ea87451 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +## Laravel Notifications for LINE Notify ![Build Status](https://github.com/moririnson/laravel-line-notify/workflows/PHP%20Composer/badge.svg) + +#### Requirement + +- PHP 7.0+ +- Laravel 5.3+ + +#### Installation + +```bash +composer require moririnson/laravel-line-notify +``` + +#### Usage + +```php +/** +* @return string token +*/ +public function routeNotificationForLINE() +{ + return 'ACCESS_TOKEN_HERE'; +} +``` + +```php + +use Illuminate\Notifications\Notification; +use Moririnson\LINENotify\Channels\LINENotifyChannel; +use Moririnson\LINENotify\Messages\LINENotifyMessage; + +class LineNotify extends Notification +{ + private $message; + + public function __construct($message) + { + $this->message = $message; + } + + public function via($notifiable) + { + return [LINENotifyChannel::class] + } + + public function toLINE($notifiable) + { + return (new LINENotifyMessage())->message($this->message); + } +} +``` + +#### Testing + +```bash +composer test +``` + +#### License + +The MIT License (MIT), Please see [License File](./LICENSE.md) for more information. \ No newline at end of file diff --git a/composer.json b/composer.json index 7d1c1ec..c91abf7 100644 --- a/composer.json +++ b/composer.json @@ -10,25 +10,24 @@ } ], "require": { - "php": ">=5.6.4", - "guzzlehttp/guzzle": "~6.0", - "illuminate/notifications": "5.3.*|5.4.*|5.5.*" + "php": ">=7.0", + "guzzlehttp/guzzle": ">=6.0", + "illuminate/notifications": ">=6.0" }, "require-dev": { - "mockery/mockery": "^0.9.5", - "phpunit/phpunit": "4.*|~6.0", - "orchestra/testbench": "3.3.x-dev|^3.5.0", - "orchestra/database": "3.3.x-dev|^3.5.0", + "mockery/mockery": "*", + "phpunit/phpunit": ">=6.0", + "orchestra/testbench": ">=4.0", "squizlabs/php_codesniffer": "3.*" }, "autoload": { "psr-4": { - "Moririnson\\LineNotify\\": "src" + "Moririnson\\LINENotify\\": "src" } }, "autoload-dev": { "psr-4": { - "Moririnson\\LineNotify\\Tests\\": "tests" + "Moririnson\\LINENotify\\Tests\\": "tests" } }, "scripts": { diff --git a/tests/Channels/LINENotifyChannelTest.php b/tests/Channels/LINENotifyChannelTest.php index 0772809..58f8cfc 100644 --- a/tests/Channels/LINENotifyChannelTest.php +++ b/tests/Channels/LINENotifyChannelTest.php @@ -1,11 +1,10 @@ client = Mockery::mock(Client::class); diff --git a/tests/Messages/LINENotifyMessageTest.php b/tests/Messages/LINENotifyMessageTest.php index bfd348d..712b3ef 100644 --- a/tests/Messages/LINENotifyMessageTest.php +++ b/tests/Messages/LINENotifyMessageTest.php @@ -1,8 +1,8 @@ message($expected); + $message = (new LINENotifyMessage())->message($expected); $this->assertEquals($expected, $message->message); - $this->message = new LineNotifyMessage($expected); + $this->message = new LINENotifyMessage($expected); $this->assertEquals($expected, $message->message); } } diff --git a/tests/Mock/TestNotifiable.php b/tests/Mock/TestNotifiable.php index 5d2ab96..9da2f63 100644 --- a/tests/Mock/TestNotifiable.php +++ b/tests/Mock/TestNotifiable.php @@ -1,6 +1,6 @@ message($this->message) ->imageThumbnail($this->image_thumbnail) ->imageFullsize($this->image_fullsize)