{"id":37265210,"url":"https://github.com/rumur/wp-notice","last_synced_at":"2026-01-16T00:06:05.504Z","repository":{"id":48936414,"uuid":"272760776","full_name":"rumur/wp-notice","owner":"rumur","description":"[WordPress] The small OOP wrapper allows to work with WordPress notices.","archived":false,"fork":false,"pushed_at":"2021-07-04T21:47:47.000Z","size":61,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T15:06:03.095Z","etag":null,"topics":["notices","wordpress"],"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/rumur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-06-16T16:38:49.000Z","updated_at":"2025-09-11T22:48:44.000Z","dependencies_parsed_at":"2022-09-04T03:20:22.841Z","dependency_job_id":null,"html_url":"https://github.com/rumur/wp-notice","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rumur/wp-notice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-notice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-notice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-notice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-notice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumur","download_url":"https://codeload.github.com/rumur/wp-notice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-notice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28474256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T00:03:33.697Z","status":"ssl_error","status_checked_at":"2026-01-15T23:58:36.859Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["notices","wordpress"],"created_at":"2026-01-16T00:06:04.687Z","updated_at":"2026-01-16T00:06:05.489Z","avatar_url":"https://github.com/rumur.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wp-notice\nThe small OOP wrapper that allows working with WordPress notices nice and clean.\n\n### Minimum Requirements:\n - PHP: 7.2+\n - WordPress: 5.3+\n\n## Installation\n\n```composer require rumur/wp-notice```\n\n### Themosis 2.x\n```php console vendor:publish --provider='Rumur\\WordPress\\Notice\\NoticeServiceProvider'```\n\n### Sage 10.x\n```wp acorn vendor:publish --provider='Rumur\\WordPress\\Notice\\NoticeServiceProvider'```\n\n### Register into WordPress\nIt registers the renderer functionality, that will display all notifications added by the package. \n```php\n\u003c?php\n// functions.php\n\n// Clean WordPress installation.\n\\Rumur\\WordPress\\Notice\\Notice::registerIntoWordPress();\n\n// Alternative way of doing this.\nadd_action('admin_notices', [\\Rumur\\WordPress\\Notice\\Notice::class, 'render']); \n\n// Themosis 2.x or Sage 10.x Installation, after you've used `vendor:publish` command.\n\\Notice::registerIntoWordPress();\n\n// Or there is another alternative way.\n// Themosis 2.x or Sage 10.x Only\n\\Rumur\\WordPress\\Notice\\Facades\\Notice::registerIntoWordPress();\n\n// Or even as a function\n// Themosis 2.x or Sage 10.x Only\nnotice()-\u003eregisterIntoWordPress();\n\n/**\n * The notice function that just need to return a string.\n *\n * @return string    \n */\nfunction rmr_notice_as_function() {\n    return __('Hello From Function', 'text-domain');\n}\n\n```\n\n```php\n\u003c?php\n// App/Notices/ExampleNotification.php\n\nnamespace App\\Notices;\n\nuse Rumur\\WordPress\\Notice\\Noticeable;\n\nclass ExampleNotification extends Noticeable\n{\n    public function message(): string\n    {\n        return __('I can change the info here', 'text-domain');\n    }\n}\n```\n\n### How to use?\nThere are several types that could be used.\n`Notice::info(...)`, `Notice::error(...)`, `Notice::warning(...)`, `Notice::success(...)`.\n\nEach of these methods could take as a param either a `string` or `Noticeable` or `\\WP_Error` instances or regular callable function `rmr_notice_as_function` that returns a string.\n```php\n\u003c?php\n\nuse App\\Notices\\ExampleNotification;\nuse App\\Domain\\Orders\\OrderRepository;\nuse Rumur\\WordPress\\Notice\\Notice;\n\n$order = OrderRepository::find(2020); \n\nif ($order-\u003eisPayed()) {\n    // Simple way.\n    Notice::info(__('Congrats', 'text-domain'));\n\n    // Makes a success message from the Noticeable instance\n    Notice::success(new ExampleNotification)\n        // ⚠️ OPTIONAL ⚠️\n        // Will be always displaying the notice, \n        // unless `DISABLE_NAG_NOTICES` defined and it's set as `true`\n        // @link https://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices#Disable_Nag_Notices\n        -\u003enag()\n        // ⚠️ OPTIONAL ⚠️\n        // Makes a notice be dismissible. Adds a close button to the notice.\n        -\u003edismissible()\n        // ⚠️ OPTIONAL ⚠️\n        // Makes a notice display it in an alternative way, \n        // by adding a background color that corresponds to its type.  \n        -\u003easAlternative()\n        // ⚠️ OPTIONAL ⚠️\n        // This options tells to a notice to postpone itself and show only when time.\n        -\u003eshowLater('tomorrow')\n        // ⚠️ OPTIONAL ⚠️\n        // This options tells to a notice to always show up until time.\n        -\u003eshowUntil('next friday')\n        // ⚠️ OPTIONAL ⚠️\n        // Tells to a notice to show up only on this pages.\n        -\u003eshowWhenPage('themes', 'tools' /*,...*/ )\n        // ⚠️ OPTIONAL ⚠️\n        // Tells to a notice to show up only if the logged in user has specific role.\n        -\u003eshowWhenRole('subscriber', 'author' /*,...*/ )\n        // ⚠️ OPTIONAL ⚠️\n        // Tells to a notice to show up only if the logged in user has specific id.\n        -\u003eshowWhenUser(1, get_user_by('id', 25) /*,...*/)\n        // ⚠️ OPTIONAL ⚠️\n        // Tells to a notice to show up only if the current screen is for specific taxonomies.\n        -\u003eshowWhenTaxonomy('category', 'post_tag' /*,...*/ )\n        // ⚠️ OPTIONAL ⚠️\n        // Tells to a notice to show up only if the current screen is for specific post type.\n        -\u003eshowWhenPostType('post', 'page' /*,...*/ );\n}\n\n```\n\n### [Available methods](#available-methods)\n| Recurrence                        |  Description                                                                 |\n|-------------------------------    |------------------------------------------------------------------------      |\n| `-\u003enag();`                        | Makes nag notice                                                             |\n| `-\u003edismissible();`                | Makes be closable/dismissible                                                |\n| `-\u003eshowWhenRole(...string);`      | Tells to show when the current user role is mentioned                        |\n| `-\u003eshowWhenRoleNot(...string);`   | Tells to show when the current user role is not in a mentioned list          |\n| `-\u003eshowWhenPage(...string);`      | Tells to show when the current screen page is mentioned                      |\n| `-\u003eshowWhenPageNot(...string);`   | Tells to show when the current screen page is not in a mentioned list        |\n| `-\u003eshowWhenTaxonomy(...string);`  | Tells to show when the current screen is for specific taxonomies             |\n| `-\u003eshowWhenTaxonomyNot(...string);` | Tells to show when the current screen is not for taxonomies mentioned in a list |\n| `-\u003eshowWhenPostType(...string);`  | Tells to show when the current screen is for specific post types             |\n| `-\u003eshowWhenPostTypeNot(...string);` | Tells to show when the current screen is not for post types mentioned in a list |\n| `-\u003eshowWhenUser(...int/WP_User);` | Tells to show when the current user is mentioned                             | \n| `-\u003eshowWhenUserNot(...int/WP_User);` | Tells to show when the current user is not in a mentioned list            | \n| `-\u003eshowLater(...string/int(timestamp)/DateTimeInterface);` | Tells to show the notice later when it's time       |\n| `-\u003eshowUntil(...string/int(timestamp)/DateTimeInterface);` | Tells to show the notice until it's time            |\n\n\u003eNote, that all conditions are using `OR` operator to check, but if there is a time condition than it'll switch to `AND` instead.  \n\n## To delete all traces when uninstalling plugin/theme which is used the package.\nIn order to delete all traces just call the `flush` method, like this `Notice::flush()`.   \n\n## License\n  This package is licensed under the MIT License - see the [LICENSE.md](https://github.com/rumur/wp-notice/blob/master/LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumur%2Fwp-notice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumur%2Fwp-notice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumur%2Fwp-notice/lists"}