{"id":15712446,"url":"https://github.com/jigarius/phpake","last_synced_at":"2025-05-12T22:53:57.876Z","repository":{"id":56998949,"uuid":"412859219","full_name":"jigarius/phpake","owner":"jigarius","description":"A make-like utility built for PHP.","archived":false,"fork":false,"pushed_at":"2025-01-13T13:56:35.000Z","size":231,"stargazers_count":8,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"1.x","last_synced_at":"2025-05-12T22:53:51.311Z","etag":null,"topics":["build-tool","cli","composer-package","makefile","php","rakefile","symfony-console","task-runner"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jigarius.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://www.paypal.me/jigarius"]}},"created_at":"2021-10-02T17:01:47.000Z","updated_at":"2025-01-13T13:55:33.000Z","dependencies_parsed_at":"2025-03-12T12:41:21.416Z","dependency_job_id":null,"html_url":"https://github.com/jigarius/phpake","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fphpake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fphpake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fphpake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fphpake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jigarius","download_url":"https://codeload.github.com/jigarius/phpake/tar.gz/refs/heads/1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253837389,"owners_count":21971981,"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":["build-tool","cli","composer-package","makefile","php","rakefile","symfony-console","task-runner"],"created_at":"2024-10-03T21:16:13.092Z","updated_at":"2025-05-12T22:53:57.854Z","avatar_url":"https://github.com/jigarius.png","language":"PHP","funding_links":["https://www.paypal.me/jigarius"],"categories":[],"sub_categories":[],"readme":"# Phpake\n\nPhpake is a make-like utility built for PHP. It is pronounced *fake* because\nthe second *p* is silent just like the second *p* in the word *elephpant*.\n\nI've always found writing a `Makefile` quite challenging because the syntax\nis similar to the shell syntax, but quite different at the same time.\nWhen I'm working with Ruby, I use [rake](https://github.com/ruby/rake) and\nit's awesome because it uses Ruby syntax. When I work with PHP, I often\nmiss having a similar tool that is easy to install, easy to use, and allows\nfull-fledged PHP syntax. Thus, Phpake was born.\n\nI invite you to use it, and I hope you like it.\n\n~ [Jigarius](https://jigarius.com/)\n\n## Installation\n\nPhpake can easily be installed with `composer`, either within a project or\nglobally on your system.\n\n### System-wide installation\n\nTo install Phpake globally on your system, use the following command:\n\n    composer global require jigarius/phpake\n\nNow, to run `phpake` from anywhere on your system, Composer's\n`vendor/bin` directory needs to be included in the the `PATH` variable.\n\n### Project installation\n\nTo install Phpake in a particular project, run the following command:\n\n    composer require jigarius/phpake\n\nYou should then be able to run it with `composer exec phpake`.\n\n## Usage\n\nTo use Phpake, start by creating a `Phpakefile` to define some tasks.\nEach task is simply a PHP function. You can read more on creating a\n`Phpakefile` under the [Phpakefile](#Phpakefile) section.\n\nHere are some common Phpake commands. You need to run them from a directory\ncontaining a `Phpakefile`.\n\n- `phpake` - shows a list of available commands.\n- `phpake hello-world` - runs the command defined by `function hello_world()`.\n- `phpake hello-human Bunny Wabbit` - passes 2 parameters to the task.\n- `phpake hello-group --help` - shows help text for the task.\n\n## Phpakefile\n\nA *Phpakefile* contains definitions of tasks that can be executed by Phpake. \nThe following subheadings are about defining such tasks. A Phpake task definition\nis simply a PHP function (a task callback). Here's are some examples:\n\n- [Hello world](examples/hello-world.phpakefile)\n- [Input Output](examples/input-output.phpakefile)\n- [Namespaces](examples/fizzbuzz.phpakefile)\n- [Variadic arguments](examples/variadic.phpakefile)\n- [Shell commands](examples/shell.phpakefile)\n- [Including commands](Phpakefile)\n\n## Simple tasks\n\nHere's a simple task that takes no input and prints some output. Just make\nsure that the function name doesn't coincide with any existing functions.\n\n```php\n/**\n * Say hello world.\n */\nfunction hello_world() {\n  echo 'Hello world' . PHP_EOL;\n}\n```\n\nThis task can then be executed as `phpake hello-world`. You can also organize\nfunctions with PHP namespaces.\n\n## Regular Parameters\n\nIf your task needs some input from the user, simply introduce one or more\narguments in the function definition.\n\n```php\nfunction hello_human($fname, $lname = NULL) {\n  // Do something\n}\n```\n\nSince `$lname` has a default value, it is treated as an optional argument.\n\n## Special parameters\n\nPhpake is built with [Symfony Console](https://symfony.com/doc/current/components/console.html),\nwhich provides certain special parameters that can help you enrich your\napplication even further. If your task has a parameter with one of these\nspecial names, it will behave specially. For more info on these objects,\nplease refer to the Symfony Console documentation.\n\n### $input\n\nA Symfony Console input object.\n\n### $output\n\nA Symfony Console output object that makes it easier to generate\nwell-formatted, colorful output.\n\n```php\nfunction hello_joey($output) {\n  $output-\u003ewriteln('Hello \u003cinfo\u003eJoey\u003c/info\u003e!');\n}\n```\n\nThe text included in `\u003cinfo\u003e\u003c/info\u003e` will appear in color.\n\n### $command\n\nName of the Symfony Console command that is being executed. It looks like the\ntask function name with some minor differences.\n\n- For a `function hello_world()` the command becomes `hello-world`\n- If defined in a namespace, it becomes `namespace:hello-world`.\n\n### $rest\n\nOften there are tasks that can accept an unlimited number of arguments. These\ncan be handled with a `$rest` parameter. It **must be** defined as the last\nargument to your function.\n\n```php\nfunction hello_group(string $you, string $rest) {\n  // Do something.\n}\n```\n\nIf a default value of `NULL` is assigned to `$rest`, it becomes optional,\notherwise, it requires one or more values.\n\n### Helpers\n\nSay, you have a function that helps other tasks but it is not a command by\nitself. Such functions can be put in a `Phpakefile` too. However, so that\nPhpake doesn't confuse them for commands, the function name must begin with\nan underscore. For example a function named `_foo()` will not result in a\ncommand named `phpake foo` because the function name starts with an underscore.\n\n## Development\n\nThis project uses a Dockerized development environment. Run the project as\nyou would any other docker-compose based project.\n\nWhen developing for the first time,\n\n- Clone the repository with `git clone`\n- `cd` into the cloned repository\n- Build Docker images: `docker compose build`\n- Bring up the containers: `docker compose up -d`\n\nAfter the initial setup, you can use the following commands:\n\n- `docker compose start`: Start the project's containers\n- `make ssh`: Launch a shell inside the project's container\n  - You'll spend most of your time here\n  - The command `phpake` should be available\n- `docker compose stop`: Stops the project's containers when you're done\n- See the `Makefile` for more helpful commands\n\n## Links\n\n- [Phpake on Packagist](https://packagist.org/packages/jigarius/phpake)\n- [Phpake: A Tool like Make/Rake Built for PHP](https://jigarius.com/blog/phpake) article on Jigarius.com\n- Phpake video tutorial (coming soon)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjigarius%2Fphpake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjigarius%2Fphpake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjigarius%2Fphpake/lists"}