Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
moririnson committed Feb 14, 2021
1 parent 9e6263e commit 98a29c3
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 28 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor

composer.lock
composer.lock
.phpunit*
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
11 changes: 5 additions & 6 deletions tests/Channels/LINENotifyChannelTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

namespace Moririnson\LineNotify\Test;
namespace Moririnson\LINENotify\Tests\Channels;

use Moririnson\LINENotify\LINENotifyException;
use Moririnson\LineNotify\Channels\LINENotifyChannel;
use Moririnson\LineNotify\Tests\Mock\TestNotifiable;
use Moririnson\LineNotify\Tests\Mock\TestNotification;
use Moririnson\LINENotify\Channels\LINENotifyChannel;
use Moririnson\LINENotify\Tests\Mock\TestNotifiable;
use Moririnson\LINENotify\Tests\Mock\TestNotification;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Response;
use Mockery;
Expand All @@ -15,7 +14,7 @@ class LINENotifyChannelTest extends TestCase
{
private $client;

public function setUp()
protected function setUp(): void
{
parent::setUp();
$this->client = Mockery::mock(Client::class);
Expand Down
8 changes: 4 additions & 4 deletions tests/Messages/LINENotifyMessageTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

namespace Moririnson\LineNotify\Test;
namespace Moririnson\LINENotify\Tests\Messages;

use Moririnson\LineNotify\Messages\LineNotifyMessage;
use Moririnson\LINENotify\Messages\LINENotifyMessage;
use Orchestra\Testbench\TestCase;

class LineMessageTest extends TestCase
{
public function testMessage()
{
$expected = 'test';
$message = (new LineNotifyMessage())->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);
}
}
2 changes: 1 addition & 1 deletion tests/Mock/TestNotifiable.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Moririnson\LineNotify\Tests\Mock;
namespace Moririnson\LINENotify\Tests\Mock;

use Illuminate\Notifications\Notifiable;

Expand Down
8 changes: 4 additions & 4 deletions tests/Mock/TestNotification.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Moririnson\LineNotify\Tests\Mock;
namespace Moririnson\LINENotify\Tests\Mock;

use Moririnson\LineNotify\Messages\LineNotifyMessage;
use Moririnson\LINENotify\Messages\LINENotifyMessage;
use Illuminate\Notifications\Notification;

class TestNotification extends Notification
Expand Down Expand Up @@ -50,11 +50,11 @@ public function __construct(
* Notification with LINE Notify.
*
* @param mixed $notifiable
* @return \Moririnson\LineNotify\Messages\LineNotifyMessage
* @return \Moririnson\LineNotify\Messages\LINENotifyMessage
*/
public function toLINE($notifiable)
{
return (new LineNotifyMessage())
return (new LINENotifyMessage())
->message($this->message)
->imageThumbnail($this->image_thumbnail)
->imageFullsize($this->image_fullsize)
Expand Down

0 comments on commit 98a29c3

Please sign in to comment.