{"id":20940012,"url":"https://github.com/micropackage/requirements","last_synced_at":"2025-05-13T22:32:05.342Z","repository":{"id":44885532,"uuid":"237448336","full_name":"micropackage/requirements","owner":"micropackage","description":"Requirements checker for WordPress plugins","archived":false,"fork":false,"pushed_at":"2023-06-23T09:01:20.000Z","size":74,"stargazers_count":42,"open_issues_count":5,"forks_count":6,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2025-04-02T09:24:05.516Z","etag":null,"topics":["composer","composer-library","micropackage","wordpress"],"latest_commit_sha":null,"homepage":null,"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/micropackage.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-31T14:37:46.000Z","updated_at":"2025-01-03T15:24:09.000Z","dependencies_parsed_at":"2024-06-18T21:37:10.925Z","dependency_job_id":"44377c0c-d2ac-4bdf-a690-32fd2770f2a9","html_url":"https://github.com/micropackage/requirements","commit_stats":{"total_commits":41,"total_committers":5,"mean_commits":8.2,"dds":"0.31707317073170727","last_synced_commit":"5efa4d00b96f49d94fec3e1284334c3d3d2f69cf"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Frequirements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Frequirements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Frequirements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Frequirements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micropackage","download_url":"https://codeload.github.com/micropackage/requirements/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036817,"owners_count":22003656,"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","composer-library","micropackage","wordpress"],"created_at":"2024-11-18T23:08:38.294Z","updated_at":"2025-05-13T22:32:02.426Z","avatar_url":"https://github.com/micropackage.png","language":"PHP","funding_links":[],"categories":["📃 About Requirements"],"sub_categories":[],"readme":"# Requirements\n\n[![BracketSpace Micropackage](https://img.shields.io/badge/BracketSpace-Micropackage-brightgreen)](https://bracketspace.com)\n[![Latest Stable Version](https://poser.pugx.org/micropackage/requirements/v/stable)](https://packagist.org/packages/micropackage/requirements)\n[![PHP from Packagist](https://img.shields.io/packagist/php-v/micropackage/requirements.svg)](https://packagist.org/packages/micropackage/requirements)\n[![Total Downloads](https://poser.pugx.org/micropackage/requirements/downloads)](https://packagist.org/packages/micropackage/requirements)\n[![License](https://poser.pugx.org/micropackage/requirements/license)](https://packagist.org/packages/micropackage/requirements)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://bracketspace.com/extras/micropackage/micropackage-small.png\" alt=\"Micropackage logo\"/\u003e\n\u003c/p\u003e\n\n## 🧬 About Requirements\n\nThis micropackage allows you to test environment requirements to run your plugin.\n\nIt can test:\n\n- PHP version\n- PHP Extensions\n- SSL state\n- WordPress version\n- Active plugins\n- Current theme\n- [DocHooks](https://github.com/micropackage/dochooks) support\n\nBut it's open for any other custom check.\n\n## 💾 Installation\n\n``` bash\ncomposer require micropackage/requirements\n```\n\n## 🕹 Usage\n\n## Basic usage\n\nIn the plugin main file:\n\n```php\n\u003c?php\n/*\nPlugin Name: My Test Plugin\nVersion: 1.0.0\n*/\n\n// Composer autoload.\nrequire_once __DIR__ . '/vendor/autoload.php' ;\n\n$requirements = new \\Micropackage\\Requirements\\Requirements( 'My Test Plugin', array(\n\t'php'                =\u003e '7.0',\n\t'php_extensions'     =\u003e array( 'soap' ),\n\t'wp'                 =\u003e '5.3',\n\t'dochooks'           =\u003e true,\n\t'ssl'                =\u003e true,\n\t'plugins'            =\u003e array(\n\t\tarray( 'file' =\u003e 'akismet/akismet.php', 'name' =\u003e 'Akismet', 'version' =\u003e '3.0' ),\n\t\tarray( 'file' =\u003e 'hello-dolly/hello.php', 'name' =\u003e 'Hello Dolly', 'version' =\u003e '1.5' )\n\t),\n\t'theme'              =\u003e array(\n\t\t'slug' =\u003e 'twentysixteen',\n\t\t'name' =\u003e 'Twenty Sixteen'\n\t),\n) );\n\n/**\n * Run all the checks and check if requirements has been satisfied.\n * If not - display the admin notice and exit from the file.\n */\nif ( ! $requirements-\u003esatisfied() ) {\n\t$requirements-\u003eprint_notice();\n\treturn;\n}\n\n// ... plugin runtime.\n```\n\n## Advanced usage\n\nYou can also define your own custom checks.\n\n```php\nclass CustomCheck extends \\Micropackage\\Requirements\\Abstracts\\Checker {\n\n\t/**\n\t * Checker name\n\t *\n\t * @var string\n\t */\n\tprotected $name = 'custom-check';\n\n\t/**\n\t * Checks if the requirement is met\n\t *\n\t * @param  string $value Requirement.\n\t * @return void\n\t */\n\tpublic function check( $value ) {\n\n\t\t// Do your check here and if it fails, add the error.\n\t\tif ( 'something' === $value ) {\n\t\t\t$this-\u003eadd_error( 'You need something!' );\n\t\t}\n\n\t}\n\n}\n\n$requirements = new \\Micropackage\\Requirements\\Requirements( 'My Test Plugin', array(\n\t'custom-check' =\u003e 'something else',\n) );\n\n$requirements-\u003eregister_checker( 'CustomCheck' );\n\n$is_good = $requirements-\u003esatisfied();\n```\n\n## 📦 About the Micropackage project\n\nMicropackages - as the name suggests - are micro packages with a tiny bit of reusable code, helpful particularly in WordPress development.\n\nThe aim is to have multiple packages which can be put together to create something bigger by defining only the structure.\n\nMicropackages are maintained by [BracketSpace](https://bracketspace.com).\n\n## 📖 Changelog\n\n[See the changelog file](./CHANGELOG.md).\n\n## 📃 License\n\nThis software is released under MIT license. See the [LICENSE](./LICENSE) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicropackage%2Frequirements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicropackage%2Frequirements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicropackage%2Frequirements/lists"}