saritasa/laravel-notifications-api

This package is abandoned and no longer maintained. No replacement package was suggested.

Implementation for notifications API

2.0.1 2022-08-26 10:52 UTC

This package is auto-updated.

Last update: 2024-09-26 15:34:55 UTC


README

PHP Unit PHP CodeSniffer Release PHPv Downloads

Implementation of Notifications API.

Laravel 5.x

Install the saritasa/laravel-notifications-api package:

$ composer require saritasa/laravel-notifications-api

If you use Laravel 5.4 or less, or 5.5+ with package discovery disabled, add the NotificationsApiServiceProvider in config/app.php:

'providers' => array(
    // ...
    Saritasa\PushNotifications\NotificationsApiServiceProvider::class,
)

For customization some library entities use artisan publish command:

  • php artisan vendor:publish --tag=saritasa-notifications-swagger

    for add yaml files for api description (note: don't forget add them to paths.yaml)

  • php artisan vendor:publish --tag=saritasa-notifications-migrations

    for customization migrations

  • php artisan vendor:publish --tag=saritasa-notifications-config

    for customization config file

Or just use to publish all customizable resources php artisan vendor:publish --tag=saritasa-notifications

Models (DB mapping)

NotificationType

Description of possible notification type, and if it should be on or off by default.

Mandatory fields

  • id (int)
  • name (string)
  • defaultOn (boolean)

NotificationSetting

User's personal setting value - if certain notification type is on or off.

Mandatory fields:

  • id (int)
  • userId (int)
  • notificationTypeId (int)
  • isOn (boolean)

Contributing

  1. Create fork, checkout it
  2. Develop locally as usual. Code must follow PSR-1, PSR-2 - run PHP_CodeSniffer to ensure, that code follows style guides
  3. Cover added functionality with unit tests and run PHPUnit to make sure, that all tests pass
  4. Update README.md to describe new or changed functionality
  5. Add changes description to CHANGES.md file. Use Semantic Versioning convention to determine next version number.
  6. When ready, create pull request

Make shortcuts

If you have GNU Make installed, you can use following shortcuts:

  • make cs (instead of php vendor/bin/phpcs) - run static code analysis with PHP_CodeSniffer to check code style
  • make csfix (instead of php vendor/bin/phpcbf) - fix code style violations with PHP_CodeSniffer automatically, where possible (ex. PSR-2 code formatting violations)
  • make test (instead of php vendor/bin/phpunit) - run tests with PHPUnit
  • make install - instead of composer install
  • make all or just make without parameters - invokes described above install, cs, test tasks sequentially - project will be assembled, checked with linter and tested with one single command

Resources