{"id":14985411,"url":"https://github.com/dstuecken/notify","last_synced_at":"2025-10-14T13:12:21.984Z","repository":{"id":56972936,"uuid":"44685928","full_name":"dstuecken/notify","owner":"dstuecken","description":"Framework agnostic and lightweight notification system (implementing the PSR LoggerInterface) with several handling adapters.","archived":false,"fork":false,"pushed_at":"2020-03-11T17:35:29.000Z","size":42,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T15:35:06.848Z","etag":null,"topics":["composer","handler","hipchat","loggerinterface","php","php7","psr-loggerinterface","syslog"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dstuecken.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-21T15:29:30.000Z","updated_at":"2020-03-11T17:35:32.000Z","dependencies_parsed_at":"2022-08-21T10:20:38.743Z","dependency_job_id":null,"html_url":"https://github.com/dstuecken/notify","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstuecken%2Fnotify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstuecken%2Fnotify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstuecken%2Fnotify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstuecken%2Fnotify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dstuecken","download_url":"https://codeload.github.com/dstuecken/notify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248359235,"owners_count":21090498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","handler","hipchat","loggerinterface","php","php7","psr-loggerinterface","syslog"],"created_at":"2024-09-24T14:10:56.027Z","updated_at":"2025-10-14T13:12:16.950Z","avatar_url":"https://github.com/dstuecken.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Notify\n\nFramework agnostic and lightweight notification system implementing the PSR LoggerInterface with several handling adapters.\n\nFeel free to implement your own handlers!\n\n[![Build Status](https://travis-ci.org/dstuecken/notify.svg)](https://travis-ci.org/dstuecken/notify)\n[![License](https://poser.pugx.org/dstuecken/notify/license)](https://packagist.org/packages/dstuecken/notify)\n[![Latest Stable Version](https://poser.pugx.org/dstuecken/notify/v/stable)](https://packagist.org/packages/dstuecken/notify)\n[![Latest Unstable Version](https://poser.pugx.org/dstuecken/notify/v/unstable)](https://packagist.org/packages/dstuecken/notify)\n\n## Requirements\n\n* PHP 5.4\n\n## Installation\n\n### Using Composer\n\nTo install Notify with Composer, just add the following to your composer.json file:\n\n```json\n{\n    \"require\": {\n        \"dstuecken/notify\": \"dev-master\"\n    }\n}\n```\n\nor by running the following command:\n\n```shell\ncomposer require dstuecken/notify\n```\n\n## Usage\n\n### Use the Header Handler\n\n```php\n\u003c?php\n$notificationCenter = new NotificationCenter();\n$notificationCenter-\u003eaddHandler(\n    new HeaderHandler('Notify', NotificationCenter::ERROR)\n);\n\n$notificationCenter-\u003eerror('There was an error.');\n```\n\nThe Header handler is used to send an HTTP Header to the Browser in the following (changable) format: X-Notify-Notification.\nThis header can then be grabed by a javascript implementation to display a nice and clean javascript error message while continuing the application with a normal response.\n\n### Use the Logger Handler\n\nYou can send your notifications to any LoggerInterface capable logger:\n\n```php\n\u003c?php\n$logger = new Logger('my-logger');\n\n$notificationCenter = new NotificationCenter();\n$notificationCenter-\u003eaddHandler(\n    new LoggerHandler($logger, NotificationCenter::ERROR)\n);\n\n$notificationCenter-\u003eerror('There was an error.');\n```\n\n### Use the HipChat Handler\n\nYou can also send all your CRITICAL notifications to hipchat, for example:\n\n```php\n\u003c?php\n$hipchat = new HipChat\\HipChat('apiKey123', );\n\n$notificationCenter = new NotificationCenter();\n$notificationCenter-\u003eaddHandler(\n    new HipChatHandler($hipchat, 'hipchat-room-id', NotificationCenter::CRITICAL, 'hipChatBotName')\n);\n\n$notificationCenter-\u003eerror('There was an error.');\n```\n\n### Push your notifications to several Handlers\n\nYou can send your notifications to different handlers in different levels:\n\n```php\n\u003c?php\n$logger = new Logger('my-logger');\n\n$notificationCenter = new NotificationCenter();\n$notificationCenter\n\t-\u003eaddHandler(\n\t    new HeaderHandler(\n\t        'Notify',\n\t        NotificationCenter::INFO\n\t    )\n\t)\n\t-\u003eaddHandler(\n\t    new LoggerHandler(new Logger(), NotificationCenter::ERROR)\n\t);\n\n$notificationCenter-\u003eerror('There was an error.', HeaderHandler::formatAttributes(null, null, true));\n```\n\n## Currently implemented Handlers\n\n### Header\n\nSends an HTTP Header, which can be observed by Javascript to represent errors as growl-like notification messages.\n\n### Logger\n\nForwards your notifications to a Logger, which implements the LoggerInterface.\n\n### MacOS\n\nDisplays a Mac OS X Notification Center Message.\n\n### HipChat\n\nDrops notifications on your hipchat rooms.\n\n### NotifySend\n\nNotify via Ubuntu's notification service.\n\n### Syslog\n\nSend your notifications to a syslog (using the PHP syslog() function).\n\n### Smarty\n\nAttach your notifications to a smarty template variable\n\n### Memory\n\nForward notifications to an array\n\n## Tests\n\nRun phpunit tests with\n\n```shell\nphpunit --bootstrap tests/bootstrap.php tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstuecken%2Fnotify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdstuecken%2Fnotify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstuecken%2Fnotify/lists"}