{"id":16427551,"url":"https://github.com/nowisesys/uup-application","last_synced_at":"2026-05-05T10:37:05.872Z","repository":{"id":57028841,"uuid":"445489129","full_name":"nowisesys/uup-application","owner":"nowisesys","description":"Run monitored command action for CLI command line and HTTP requests.","archived":false,"fork":false,"pushed_at":"2022-01-10T14:32:55.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-11T14:53:17.386Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nowisesys.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":"2022-01-07T10:52:18.000Z","updated_at":"2022-01-10T14:32:55.000Z","dependencies_parsed_at":"2022-08-23T16:20:45.387Z","dependency_job_id":null,"html_url":"https://github.com/nowisesys/uup-application","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nowisesys/uup-application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nowisesys","download_url":"https://codeload.github.com/nowisesys/uup-application/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32646200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-11T08:13:20.030Z","updated_at":"2026-05-05T10:37:05.854Z","avatar_url":"https://github.com/nowisesys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"UUP-APPLICATION\n==========================================\n\nRun the same command action both for CLI command line and HTTP requests with monitoring.\n\n### ACTIONS:\n\nThe action class handles business logic and the runner executes and monitor the action. \n\n#### Example\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nrequire_once(__DIR__ . '/../vendor/autoload.php');\n\nuse UUP\\Application\\Actions\\HelloWorldAction;\nuse UUP\\Application\\Command\\ApplicationRunner;\n\n$action = new HelloWorldAction();\n$runner = new ApplicationRunner($action);\n$runner-\u003eexecute();\n\n```\n\n### LIFETIME:\n\nThe action class derives from `ApplicationAction` and implements the lifetime methods `usage()`, `setup()`, \n`execute()` and `cleanup()`. At least the setup method should be implemented, the other are optional.\n\n```php\nclass HelloWorldAction extends ApplicationAction\n{\n    public function setup(): void\n    {\n        if ($this-\u003eoptions-\u003eisMissing('my-name')) {\n            $this-\u003eoptions-\u003esetOption('my-name', \"Anders\");\n        }\n    }\n\n    public function execute(): void\n    {\n        if ($this-\u003eoptions-\u003ehasOption('my-name')) {\n            printf(\"Hello world, %s!\\n\", $this-\u003eoptions-\u003egetString('my-name'));\n        }\n    }\n}\n```\n\n### OPTIONS:\n\nCommand options are passed from CLI command options or HTTP request depending on execution context. The runner takes\nare of handling help or quiet options. The standard options `help`, `version` and `quiet` are transparent handled along \nwith their short option equivalents.\n\n### MONITOR:\n\nThe runner execute the action class and provides error monitoring. By default, runner will terminate action when a \nthrowable get caught. The error behavior can be overridden by action class.\n\n### INLINE:\n\nFor simple tasks, use an anonymous (java-style) class with implementations of wanted methods:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nrequire_once(__DIR__ . '/../vendor/autoload.php');\n\nuse UUP\\Application\\Command\\ApplicationAction;\nuse UUP\\Application\\Command\\ApplicationRunner;\n\n(new ApplicationRunner(new class extends ApplicationAction {\n\n    public function execute(): void\n    {\n        // TODO: Implement the business logic for script (this method is required).\n    }\n\n}))-\u003eexecute();\n```\n\nSee [example](example) directory for code examples.\n\n### INFORMATION:\n\nProvide `help` and `version` information by overriding base class methods in your action class.\n\n#### HELP\n\nOverride the `usage()` method. Call parent method to output standard options.\n\n```php\nclass HelloWorldAction extends ApplicationAction\n{\n    public function usage(): void\n    {\n        printf(\"Sample greeter action class.\\n\");\n        printf(\"\\n\");\n        printf(\"Options:\\n\");\n        printf(\"  my-name:    Set caller name.\\n\");\n        printf(\"\\n\");\n\n        parent::usage();\n    }\n\n    ...\n}\n```\n\n#### VERSION\n\nSimilar to usage, but override the `version()` instead. This method gives full control of version output.\n\n```php\nclass HelloWorldAction extends ApplicationAction\n{\n    public function version(): void\n    {\n        printf(\"hello-world %s\\n\", $this-\u003egetVersion());\n    }\n\n    public function getVersion(): string\n    {\n        return \"1.2.2\";\n    }\n\n    ...\n}\n```\n\nIf default version format is OK, then overriding the `getVersion()` method should be sufficient. \n\n#### ZERO MAINTENANCE:\n\n**Hint:** Consider reading version string from your package composer.json file instead of using a hard coded string \nthat requires manual update!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowisesys%2Fuup-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnowisesys%2Fuup-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowisesys%2Fuup-application/lists"}