Skip to content

Commit

Permalink
Merge branch 'release-2.0.0' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Feb 16, 2018
2 parents fe1d863 + 9edf583 commit a2937dd
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 119 deletions.
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
"keywords": ["laravel", "framework", "console", "artisan", "php", "wrapper", "JoliNotif", "notification", "notifier", "Nuno Maduro", "NunoMaduro"],
"license": "MIT",
"require": {
"php": ">=5.5.9",
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
"jolicode/jolinotif": "^1.1"
"php": "^7.1.3",
"illuminate/support": "5.6.*",
"illuminate/console": "5.6.*",
"jolicode/jolinotif": "2.0.*"
},
"require-dev": {
"graham-campbell/testbench": "^3.1",
"phpunit/phpunit": "^4.8|^5.0"
"graham-campbell/testbench": "dev-master",
"phpunit/phpunit": "^7.0"
},
"authors": [
{
Expand Down
86 changes: 24 additions & 62 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,53 @@
<p align="center"><img height="120px" src="https://raw.githubusercontent.com/nunomaduro/laravel-desktop-notifier/stable/docs/icon.png"></p>

Laravel Desktop Notifier
================

Laravel Desktop Notifier was created by, and is maintained by [Nuno Maduro](https://github.com/nunomaduro), and is a [JoliNotif](https://github.com/jolicode/JoliNotif) wrapper for [Laravel](http://laravel.com). Feel free to check out the [change log](CHANGELOG.md), [releases](nunomaduro/laravel-desktop-notifier/releases), [license](LICENSE), and [contribution guidelines](CONTRIBUTING.md).
<p align="center">
<img src="ttps://raw.githubusercontent.com/nunomaduro/laravel-desktop-notifier/stable/docs/icon.png" width="100%">
</p>

<p align="center">
<a href="https://styleci.io/repos/94141482"><img src="https://styleci.io/repos/94141482/shield" alt="StyleCI Status"></img></a>
<a href="https://travis-ci.org/nunomaduro/laravel-desktop-notifier"><img src="https://img.shields.io/travis/nunomaduro/laravel-desktop-notifier/stable.svg?style=flat-square" alt="Build Status"></img></a>
<a href="https://scrutinizer-ci.com/g/nunomaduro/laravel-desktop-notifier"><img src="https://img.shields.io/scrutinizer/g/nunomaduro/laravel-desktop-notifier.svg?style=flat-square" alt="Quality Score"></img></a>
<a href="https://github.com/nunomaduro/laravel-desktop-notifier/releases"><img src="https://img.shields.io/github/release/nunomaduro/laravel-desktop-notifier.svg?style=flat-square" alt="Latest Version"></img></a>
<a href="https://packagist.org/packages/nunomaduro/laravel-console-task"><img src="https://poser.pugx.org/nunomaduro/laravel-console-task/license.svg" alt="License"></a>
<a href="https://styleci.io/repos/94141482"><img src="https://styleci.io/repos/94141482/shield" alt="StyleCI Status"></img></a>
<a href="https://travis-ci.org/nunomaduro/laravel-desktop-notifier"><img src="https://img.shields.io/travis/nunomaduro/laravel-desktop-notifier/stable.svg?style=flat-square" alt="Build Status"></img></a>
<a href="https://scrutinizer-ci.com/g/nunomaduro/laravel-desktop-notifier"><img src="https://img.shields.io/scrutinizer/g/nunomaduro/laravel-desktop-notifier.svg?style=flat-square" alt="Quality Score"></img></a>
<a href="https://github.com/nunomaduro/laravel-desktop-notifier/releases"><img src="https://img.shields.io/github/release/nunomaduro/laravel-desktop-notifier.svg?style=flat-square" alt="Latest Version"></img></a>
<a href="https://packagist.org/packages/nunomaduro/laravel-console-task"><img src="https://poser.pugx.org/nunomaduro/laravel-console-task/license.svg" alt="License"></a>
</p>

## Installation
## About Laravel Desktop Notifier

[PHP](https://php.net) 5.5+
Laravel Desktop Notifier was created by, and is maintained by [Nuno Maduro](https://github.com/nunomaduro), and is a replacement for the List Command in Laravel Console Commands.

To get the latest version of Laravel Desktop Notifier, simply require the project using [Composer](https://getcomposer.org):
## Installation

```bash
$ composer require nunomaduro/laravel-desktop-notifier
```
> **Requires [PHP 7.1+](https://php.net/releases/)**
Instead, you may of course manually update your require block and run `composer update` if you so choose:
Require Laravel Desktop Notifier using [Composer](https://getcomposer.org):

```json
{
"require": {
"nunomaduro/laravel-desktop-notifier": "^1.0"
}
}
```bash
composer require nunomaduro/laravel-desktop-notifier
```

## Usage with Trait
## Usage

```php
use Illuminate\Console\Command;
use NunoMaduro\LaravelDesktopNotifier\Notifications;

class Zonda extends Command
class ZondaCommand extends Command
{
use Notifications;

public function handle()
{
$this->notify('Hello Web Artisan', 'Love beautiful code? We do too!');
}
}
```

## Usage with Laravel IOC container

```php
use Illuminate\Console\Command;
use NunoMaduro\LaravelDesktopNotifier\Contracts\Notifier;
use NunoMaduro\LaravelDesktopNotifier\Contracts\Notification;

class Zonda extends Command
{
public function handle()
{
$notifier = app(Notifier::class);

$notification = app(Notification::class)
->setTitle('Hello Web Artisan')
->setBody('Love beautiful code? We do too!')
->setIcon(__DIR__ . '/path/to/your/icon.png');

$notifier->send($notification);
}
}
```

## Git branching model

The git branching model used for development is the one described and assisted by `twgit` tool: [https://github.com/Twenga/twgit](https://github.com/Twenga/twgit).

## Stay In Touch

For latest releases and announcements, follow on Twitter: [@enunomaduro](https://twitter.com/enunomaduro)

## Contributing

Thank you for considering to contribute to Laravel Desktop Notifier. All the contribution guidelines are mentioned [here](CONTRIBUTING.md).

You can have a look at the [CHANGELOG](CHANGELOG.md) for constant updates & detailed information about the changes. You can also follow the twitter account for latest announcements: [@enunomaduro](https://twitter.com/enunomaduro)
You can have a look at the [CHANGELOG](CHANGELOG.md) for constant updates & detailed information about the changes. You can also follow the twitter account for latest announcements or just come say hi!: [@enunomaduro](https://twitter.com/enunomaduro)

## Support the development
**Do you like this project? Support it by donating**

- PayPal: [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L)
- Patreon: [Donate](https://www.patreon.com/nunomaduro)

## License

Expand Down
6 changes: 3 additions & 3 deletions src/Contracts/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function getTitle();
*
* @return \NunoMaduro\LaravelDesktopNotifier\Contracts\Notification
*/
public function setTitle($title);
public function setTitle(string $title): \Joli\JoliNotif\Notification;

/**
* @return string
Expand All @@ -40,7 +40,7 @@ public function getBody();
*
* @return \NunoMaduro\LaravelDesktopNotifier\Contracts\Notification
*/
public function setBody($body);
public function setBody(string $body): \Joli\JoliNotif\Notification;

/**
* @return string
Expand All @@ -52,5 +52,5 @@ public function getIcon();
*
* @return \NunoMaduro\LaravelDesktopNotifier\Contracts\Notification
*/
public function setIcon($icon);
public function setIcon(string $icon): \Joli\JoliNotif\Notification;
}
40 changes: 33 additions & 7 deletions src/LaravelDesktopNotifierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,48 @@

namespace NunoMaduro\LaravelDesktopNotifier;

use Illuminate\Support\ServiceProvider;
use Joli\JoliNotif\NotifierFactory;
use NunoMaduro\LaravelDesktopNotifier\Contracts\Notification as NotificationContract;
use Illuminate\Console\Command;
use Illuminate\Support\ServiceProvider;
use NunoMaduro\LaravelDesktopNotifier\Contracts\Notifier as NotifierContract;
use NunoMaduro\LaravelDesktopNotifier\Contracts\Notification as NotificationContract;

/**
* The is the Laravel Desktop Notifier service provider class.
*
* @author Nuno Maduro <[email protected]>
*/
class LaravelDesktopNotifierServiceProvider extends ServiceProvider
{
/**
* Register the laravel desktop notifier implementation.
*
* @return void
* {@inheritdoc}
*/
public function boot()
{
/*
* Sends a desktop notification.
*
* @param string $title
* @param string $body
* @param string|null $icon
*
* @return void
*/
Command::macro(
'notify',
function (string $text, string $body, $icon = null) {
$notifier = $this->app[Contracts\Notifier::class];

$notification = $this->app[Contracts\Notification::class]
->setTitle($text)
->setBody($body)
->setIcon($icon);

$notifier->send($notification);
}
);
}

/**
* {@inheritdoc}
*/
public function register()
{
Expand Down
39 changes: 0 additions & 39 deletions src/Notifications.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ public function __construct(BaseNotifier $notifier)
/**
* {@inheritdoc}
*/
public function isSupported()
public function isSupported(): bool
{
return $this->notifier->isSupported();
}

/**
* {@inheritdoc}
*/
public function getPriority()
public function getPriority(): int
{
return $this->notifier->getPriority();
}

/**
* {@inheritdoc}
*/
public function send(\Joli\JoliNotif\Notification $notification)
public function send(\Joli\JoliNotif\Notification $notification): bool
{
return $this->notifier->send($notification);
}
Expand Down

0 comments on commit a2937dd

Please sign in to comment.