Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrech committed Mar 1, 2015
0 parents commit 3cfc08a
Show file tree
Hide file tree
Showing 30 changed files with 2,863 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# IDE
.build_dir
.externalTollBuilders
.settings
.project
.buildpath
deps.lock
.idea

# OS
.DS_Store
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes
.buildpath
.project
.settings

# Dependencies
/vendor

# Composer
composer.phar
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changes between versions

## Not yet released

* added Notification, Notifier and Driver
* added NotifySendDriver (can be used on most Linux distributions)
* added TerminalNotifierDriver (can be used on Mac OS X 10.8 and higher)
* added GrowlNotifyDriver (can be used on Mac OS if growlnotify is available)
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# How to contribute

Everybody should be able to help. Here's how you can make this project more
awesome:

1. [Fork it](https://github.com/jolicode/JoliNotif/fork_select)
2. improve it
3. submit a [pull request](https://help.github.com/articles/creating-a-pull-request)

Your work will then be reviewed as soon as possible (suggestions about some
changes, improvements or alternatives may be given).

Here's some tips to make you the best contributor ever:

* [Green tests](#green-tests)
* [Standard code](#standard-code)
* [Keeping your fork up-to-date](#keeping-your-fork-up-to-date)

## Green tests

Run the tests using the following script:

vendor/bin/phpunit

## Standard code

Use [PHP CS fixer](http://cs.sensiolabs.org/) to make your code compliant with
JoliNotif's coding standards:

vendor/bin/php-cs-fixer fix --config=sf23 .

## Keeping your fork up-to-date

To keep your fork up-to-date, you should track the upstream (original) one
using the following command:

git remote add upstream https://github.com/jolicode/JoliNotif.git

Then get the upstream changes:

git checkout master
git pull --rebase origin master
git pull --rebase upstream master
git checkout <your-branch>
git rebase master

Finally, publish your changes:

git push -f origin <your-branch>

Your pull request will be automatically updated.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015 Loïck Piera

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.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# JoliNotif

JoliNotif allows you to send notification to your system directly from your php
script. The notifier will take care to use the right command available, without
having to worry if you're running on Linux, Windows or MacOS.

JoliNotif can be used from your long running task, f.e. to inform your user
that a task just finished. Originally inspired by [mikaelbr/node-notifier](https://github.com/mikaelbr/node-notifier).

## Getting started

Use [Composer](http://getcomposer.org/) to install JoliNotif in your projects:


composer require "jolicode/jolinotif"


## Usage

The main class is `Notifier`. It should be instantiated with an array of
`Driver`. The `Notifier` constructor will choose the best driver to use,
according to which commands are available on your system. If no driver are
supported, a `SystemNotSupportedException` will be thrown.

Look at below (or [example/index.php](example/index.php)) to see an example on
how to use JoliNotif.

```php
// Build a Notifier
$notifier = new Notifier([
new TerminalNotifierDriver(),
new GrowlNotifyDriver(),
new NotifySendDriver(),
]);

// Create your notification
$notification = new Notification();
$notification->setTitle('I\'m a notification title');
$notification->setBody('And this is the body');
$notification->setIcon(__DIR__.'/notification-icon.png');

// Send it
$notifier->send($notification);
```

> **Important**: The only required property on Notification is the body.
> The notifier will throw an InvalidNotificationException if it is empty.
> **Note**: New properties could be added later on Notification. Drivers are
> designed to only handle the supported properties and discard not supported
> ones without throwing any exception.
## Further documentation

You can see the current and past versions using one of the following:

* the `git tag` command
* the [releases page on Github](https://github.com/jolicode/JoliNotif/releases)
* the file listing the [changes between versions](CHANGELOG.md)

You can find more documentation at the following links:

* [copyright and MIT license](LICENSE)
* [versioning and branching models](VERSIONING.md)
* [contribution instructions](CONTRIBUTING.md)
22 changes: 22 additions & 0 deletions VERSIONING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Versioning and branching models

This file explains the versioning and branching models of this project.

## Versioning

The versioning is inspired by [Semantic Versioning](http://semver.org/):

> Given a version number MAJOR.MINOR.PATCH, increment the:
>
> 1. MAJOR version when you make incompatible API changes
> 2. MINOR version when you add functionality in a backwards-compatible manner
> 3. PATCH version when you make backwards-compatible bug fixes
## Branching Model

The branching is inspired by [@jbenet](https://github.com/jbenet)
[simple git branching model](https://gist.github.com/jbenet/ee6c9ac48068889b0912):

> 1. `master` must always be deployable.
> 2. **all changes** are made through feature branches (pull-request + merge)
> 3. rebase to avoid/resolve conflicts; merge in to `master`
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "jolicode/jolinotif",
"license": "MIT",
"type": "library",

"description": "Send desktop notifications on Windows, Linux, MacOS.",
"keywords": ["notification", "windows", "linux", "mac", "growl"],
"minimum-stability": "stable",

"autoload": {
"psr-4": {
"JoliNotif\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"JoliNotif\\tests\\": "tests/"
}
},
"require": {
"php": ">=5.4.0",
"symfony/process": "~2.6"
},
"require-dev": {
"phpunit/phpunit": "~4.5",
"fabpot/php-cs-fixer": "~1.5"
}
}
Loading

0 comments on commit 3cfc08a

Please sign in to comment.