{"id":15355080,"url":"https://github.com/adhocore/phint","last_synced_at":"2025-07-15T15:44:12.948Z","repository":{"id":49147971,"uuid":"108550679","full_name":"adhocore/phint","owner":"adhocore","description":"Interactively scaffolds and init new (or fixup old) PHP project/library with sane defaults using templates in no time","archived":false,"fork":false,"pushed_at":"2023-03-25T14:34:06.000Z","size":307,"stargazers_count":95,"open_issues_count":6,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-15T15:15:08.674Z","etag":null,"topics":["adhocore","bootstrap","docs-generator","hack","init-project","kickstart-php","php-project-init","php-project-scaffolding","project-template","scaffolding","test-generator"],"latest_commit_sha":null,"homepage":"https://github.com/adhocore/phint","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/adhocore.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"adhocore","custom":["https://paypal.me/ji10"]}},"created_at":"2017-10-27T13:37:41.000Z","updated_at":"2025-03-10T22:19:50.000Z","dependencies_parsed_at":"2023-10-20T16:20:54.424Z","dependency_job_id":null,"html_url":"https://github.com/adhocore/phint","commit_stats":{"total_commits":381,"total_committers":4,"mean_commits":95.25,"dds":0.02887139107611547,"last_synced_commit":"56cb6e8587df0c9a3135d64886b3737bc98abb03"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/adhocore/phint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fphint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fphint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fphint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fphint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adhocore","download_url":"https://codeload.github.com/adhocore/phint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fphint/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265443566,"owners_count":23766417,"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":["adhocore","bootstrap","docs-generator","hack","init-project","kickstart-php","php-project-init","php-project-scaffolding","project-template","scaffolding","test-generator"],"created_at":"2024-10-01T12:22:24.859Z","updated_at":"2025-07-15T15:44:12.893Z","avatar_url":"https://github.com/adhocore.png","language":"PHP","funding_links":["https://github.com/sponsors/adhocore","https://paypal.me/ji10","https://www.paypal.me/ji10/15usd","https://www.paypal.me/ji10/25usd","https://www.paypal.me/ji10/50usd"],"categories":[],"sub_categories":[],"readme":"## adhocore/phint\n\nInitializes new PHP project with sane defaults using templates.\nIt scaffolds PHP library \u0026/or project to boost your productivity and save time.\n\nFor already existing project, run with `--sync` flag to add missing stuffs, see [phint init](#init).\n\nOnce you have files in your `src/` or `lib/` you can run [phint docs](#docs) to generate API like documentation in `.md` format\nand [phint test](#test) to generate basic test stubs with all the structures already maintained.\n\nIt helps you be even more lazier! **phint** is continuously evolving and the plan is to make it [big](#todo).\n\n[![Latest Version](https://img.shields.io/github/release/adhocore/phint.svg?style=flat-square)](https://github.com/adhocore/phint/releases)\n[![Travis Build](https://img.shields.io/travis/adhocore/phint/master.svg?style=flat-square)](https://travis-ci.org/adhocore/phint?branch=master)\n[![Scrutinizer CI](https://img.shields.io/scrutinizer/g/adhocore/phint.svg?style=flat-square)](https://scrutinizer-ci.com/g/adhocore/phint/?branch=master)\n[![Codecov branch](https://img.shields.io/codecov/c/github/adhocore/phint/master.svg?style=flat-square)](https://codecov.io/gh/adhocore/phint)\n[![StyleCI](https://styleci.io/repos/108550679/shield)](https://styleci.io/repos/108550679)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Scaffold+new+PHP+project+with+sane+defaults+using+templates\u0026url=https://github.com/adhocore/phint\u0026hashtags=php,template,scaffold,initproject)\n[![Support](https://img.shields.io/static/v1?label=Support\u0026message=%E2%9D%A4\u0026logo=GitHub)](https://github.com/sponsors/adhocore)\n\u003c!-- [![Donate 15](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square\u0026label=donate+15)](https://www.paypal.me/ji10/15usd)\n[![Donate 25](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square\u0026label=donate+25)](https://www.paypal.me/ji10/25usd)\n[![Donate 50](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square\u0026label=donate+50)](https://www.paypal.me/ji10/50usd) --\u003e\n\n\n![Phint Preview](https://imgur.com/F6PkX9Z.png \"Phint Preview\")\n\n[Installation](#installation) \u0026middot; [Features](#features) \u0026middot; [Autocompletion](#autocompletion) \u0026middot; [Usage](#usage) \u0026middot; [phint init](#init) \u0026middot; [phint update](#update) \u0026middot; [phint docs](#docs) \u0026middot; [phint test](#test) \u0026middot; [Templating](#templating)\n\n\u003e Phint is powered by [adhocore/cli](https://github.com/adhocore/php-cli)\n\n## Installation\n\n\u003e Requires PHP7.\n\n### Manual\n\nDownload `phint.phar` from [latest release](https://github.com/adhocore/phint/releases/latest).\nAnd use it like so `php /path/to/phint.phar [opts] [args]`. Hmm not cool. See Command section below.\n\n### Command\n\n```bash\n# get latest version (you need `jq`)\nLATEST_PHINT=`curl --silent \"https://api.github.com/repos/adhocore/phint/releases/latest\" | jq -r .tag_name`\n\n# download latest phint\ncurl -sSLo ~/phint.phar \"https://github.com/adhocore/phint/releases/download/$LATEST_PHINT/phint.phar\"\n\n# make executable\nchmod +x ~/phint.phar\nsudo ln -s ~/phint.phar /usr/local/bin/phint\n\n# check\nphint --help\n```\n\n## Features\n\n- generate dot files the likes of `.gitignore, .travis.yml, . editorconfig` etc\n- generate `LICENSE`, `README.md`, `composer.json`\n- generate `CHANGELOG.md` stub, `CONTRIBUTING.md` guide, `ISSUE_TEMPLATE.md` and `PULL_REQUEST_TEMPLATE.md`\n- generate binaries if any\n- git init\n- interactively ask and install all the dev and prod deps\n- generate `phpunit.xml`, test `bootstrap.php`\n- generate test stubs for all classes/methods corresponding to `src` (`phint test`)\n- generate docs for all public class/methods\n- export templates to chosen path so it can be customized (`phint export`)\n- use custom templates from a path specified by user\n- update its own self (`phint update`)\n\n## Autocompletion\n\nThe phint commands and options can be [autocompleted](https://github.com/adhocore/php-cli#autocompletion) if you use zsh shell with oh-my-zsh.\n\nSetting up auto complete:\n\n```sh\nmkdir -p ~/.oh-my-zsh/custom/plugins/ahccli \u0026\u0026 cd ~/.oh-my-zsh/custom/plugins/ahccli\n\n[ -f ./ahccli.plugin.zsh ] || curl -sSLo ./ahccli.plugin.zsh https://raw.githubusercontent.com/adhocore/php-cli/master/ahccli.plugin.zsh\n\necho compdef _ahccli phint \u003e\u003e ./ahccli.plugin.zsh\n\nchmod +x ./ahccli.plugin.zsh \u0026\u0026 source ./ahccli.plugin.zsh \u0026\u0026 cd -\n```\n\nDont forget to [add](https://github.com/adhocore/php-cli#load-ahccli-plugin) `ahccli` into `plugins=(... ...)` list in `~/.zshrc` file.\n\n## Usage\n\nIt can be used to quickly spin off new  project containing all basic and default stuffs. The quick steps are as follows:\n\n```bash\n# See options/arguments\nphint init --help\n\n# OR (shortcut)\nphint i -h\n\n# Below command inits a brand new PHP project in `project-name` folder in current dir\n# Missing arguments are interactively collected\nphint init project-name\n\n# You can also use config file (with json) to read option values from\nphint init project-name --config phint.json\n```\n\n## Commands\n\nEach of the commands below should be used like so:\n```sh\ncd /path/to/project\nphint \u003ccommand\u003e [--options] [args]\n```\n\n### init\n\n\u003e alias i\n\nCreate and Scaffold a bare new PHP project.\n\n***Parameters:***\n\nDont be intimidated by long list of parameters, you are not required to enter any of them\nas arguments as they are interactively collected when required.\n\nAlso check [config](#example-config) on how to create a reusable json config so you can use `phint` like a *pro*.\n\n```\nArguments:\n  \u003cproject\u003e  The project name without slashes\n\nOptions:\n  [-b, --bin...]            Executable binaries\n  [-c, --no-codecov]        Disable codecov\n  [-C, --config]            JSON filepath to read config from\n  [-d, --descr]             Project description\n  [-D, --dev...]            Developer packages\n  [-e, --email]             Vendor email\n  [-f, --force]             Run even if the project exists\n  [-G, --gh-template]       Use `.github/` as template path\n                            By default uses `docs/`\n  [-h, --help]              Show help\n  [-w, --keywords...]       Project Keywords\n  [-L, --license]           License (m: MIT, g: GNULGPL, a: Apache2, b: BSDSimple, i: ISC, w: WTFPL)\n  [-n, --name]              Vendor full name\n  [-N, --namespace]         Root namespace (use `/` separator)\n  [-g, --package]           Packagist name (Without vendor handle)\n  [-p, --path]              The project path (Auto resolved)\n  [-P, --php]               Minimum PHP version\n  [-R, --req...]            Required packages\n  [-s, --no-scrutinizer]    Disable scrutinizer\n  [-l, --no-styleci]        Disable StyleCI\n  [-S, --sync]              Only create missing files\n                            Use with caution, take backup if needed\n  [-t, --no-travis]         Disable travis\n  [-T, --type]              Project type\n  [-u, --username]          Vendor handle/username\n  [-z, --using]             Reference package\n  [-y, --year]              License Year\n\nUsage Examples:\n  phint init \u003cproject\u003e --force --descr \"Awesome project\" --name \"YourName\" --email you@domain.com\n  phint init \u003cproject\u003e --using laravel/lumen --namespace Project/Api --type project\u003c/comment\u003e\n  phint init \u003cproject\u003e --php 7.0 --config /path/to/json --dev mockery/mockery --req adhocore/cli\n```\n\n### Example config\n\nParameters sent via command args will have higher precedence than values from config file (`-C --config`).\n\nWhat can you put in config? Anything but we suggest you put only known options (check `$ phint init --help`)\n\n```json\n{\n  \"type\": \"library\",\n  \"namespace\": \"Ahc\",\n  \"username\": \"adhocore\",\n  \"name\": \"Jitendra Adhikari\",\n  \"email\": \"jiten.adhikary@gmail.com\",\n  \"php\": \"7.0\",\n  \"codecov\": false,\n  \"...\": \"...\"\n}\n```\n\n---\n## update\n\n\u003e alias u\n\nUpdate Phint to lastest version or rollback to earlier locally installed version.\n\n***Parameters:***\n\n```\nOptions:\n  [-h, --help]         Show help\n  [-r, --rollback]     Rollback to earlier version\n\nUsage Examples:\n  phint update        Updates to latest version\n  phint u             Also updates to latest version\n  phint update -r     Rolls back to prev version\n  phint u --rollback  Also rolls back to prev version\n```\n\n---\n## docs\n\n\u003e alias d\n\nGenerate docs (`.md`) for all public classes and methods from their docblocks.\n\nIdeally you would run it on existing project **or** after you create/update `src/` files.\n\n***Parameters:***\n\n```\nOptions:\n  [-a, --with-abstract]    Create docs for abstract/interface class\n  [-h, --help]             Show help\n  [-o, --output]           Output file (default README.md). For old project you should use something else\n                           (OR mark region with \u003c!-- DOCS START --\u003e and \u003c!-- DOCS END --\u003e to inject docs)\n\nUsage Examples:\n  phint docs               If there is `\u003c!-- DOCS START --\u003e` and `\u003c!-- DOCS END --\u003e` region\n                           Injects new doc in between them otherwise appends to bottom\n  phint d -o docs/api.md   Writes to docs/api.md (Same rule applies regarding inject/append)\n```\n\n### Sample docs\n\n***PHP code***\n\n```php\nnamespace Abc;\n\n/**\n * This is dummy class.\n *\n * It does nothing as of now.\n * Maybe you could fix it?\n */\nclass Dummy\n{\n    /**\n     * Alpha beta.\n     *\n     * Example:\n     *\n     * \u003ccode\u003e\n     * $dummy = new Dummy;\n     * $dummy-\u003ealpha('john', true);\n     * // '...'\n     * \u003c/code\u003e\n     *\n     * @param string $name\n     * @param bool   $flag\n     *\n     * @return string|null\n     */\n    public function alpha($name, $flag)\n    {\n        //\n    }\n}\n```\n\n***Generated Markdown***\n\n```md\n## Dummy\n\n```php\nuse Abc\\Dummy;\n\\```\n\n\u003e This is dummy class.\n\nIt does nothing as of now.\nMaybe you could fix it?\n\n### alpha()\n\n\u003e Alpha beta.\n\n```php\nalpha(string $name, bool $flag): string|null\n\\```\n\nExample:\n\n```php\n$dummy = new Dummy;\n$dummy-\u003ealpha('john', true);\n// '...'\n\\```\n```\n\n***Preview***\n\n## Dummy\n\n```php\nuse Ahc\\Dummy;\n```\n\n\u003e This is dummy class.\n\nIt does nothing as of now.\nMaybe you could fix it?\n\n### alpha()\n\n\u003e Alpha beta.\n\n```php\nalpha(string $name, bool $flag): string|null\n```\n\nExample:\n\n```php\n$dummy = new Dummy;\n$dummy-\u003ealpha('john', true);\n// '...'\n```\n\n---\n## test\n\n\u003e alias t\n\nGenerate test files with proper classes and test methods analogous to their source counterparts.\nIf a test class already exists, it is skipped. In future we may append test stubs for new methods.\n\nIdeally you would run it on existing project **or** after you create/update `src/` files.\n\n***Parameters:***\n\n```\nOptions:\n  [-a, --with-abstract]    Create stub for abstract/interface class\n  [-h, --help]             Show help\n  [-n, --naming]           Test method naming format\n                           (t: testMethod | m: test_method | i: it_tests_)\n  [-p, --phpunit]          Base PHPUnit class to extend from\n  [-s, --no-setup]         Dont add setup method\n  [-t, --no-teardown]      Dont add teardown method\n\nUsage Examples:\n  phint test -n i        With `it_` naming\n  phint t --no-teardown  Without `tearDown()`\n  phint test -a          With stubs for abstract/interface\n```\n\n### Sample test\n\nGenerated `tests/Dummy.php` for [Abc\\\\Dummy](#sample-docs) above:\n\n```php\n\u003c?php\n\nnamespace Abc\\Test;\n\nuse Abc\\Dummy;\nuse PHPUnit\\Framework\\TestCase as TestCase;\n\n/**\n * Auto generated by `phint test`.\n */\nclass DummyTest extends TestCase\n{\n    /**\n     * @var Dummy\n     */\n    protected $dummy;\n\n    public function setUp()\n    {\n        parent::setUp();\n\n        $this-\u003edummy = new Dummy;\n    }\n\n    public function testAlpha()\n    {\n        $actual = $this-\u003edummy-\u003ealpha();\n\n        // $this-\u003eassertSame('', $actual);\n    }\n}\n```\n\n---\n## Templating\n\n\u003e `phint export --to ~/myphint`\n\nSo you would like to have your own templates and customize `phint` to your taste!\n\nFirst you need to create a directory root (of any name, eg: `myphint`) with structure that looks like:\n\n```tree\nmyphint\n├── CHANGELOG.md.twig\n├── composer.json.twig\n├── CONTRIBUTING.md.twig\n├── docs\n│   ├── docs.twig\n│   ├── ISSUE_TEMPLATE.md.twig\n│   └── PULL_REQUEST_TEMPLATE.md.twig\n├── .editorconfig.twig\n├── .env.example.twig\n├── .gitignore.twig\n├── LICENSE.twig\n├── package.json.twig\n├── phpunit.xml.dist.twig\n├── README.md.twig\n├── tests\n│   ├── bootstrap.php.twig\n│   └── test.twig\n└── .travis.yml.twig\n```\n\nNote that you dont need to have all the files there in new directory just pick the ones you would like to customize and start hacking.\n\nLuckily you **dont** have to create these templates yourself, just run `phint export --to ~/myphint`!\n\n**Pro Tip**\nYou can actually introduce any new template as long as their extension is `.twig`.\nSuch templates are *only* used by `phint init` command. Check [Template variables](#template-variables).\n\nAfter you are done customizing these templates you can use them in each of the *phint* commands like so\n\n```sh\nphint init project --template ~/myphint\nphint docs --template ~/myphint\nphint test --template ~/myphint\n```\n\nThe short option name for `--template` is `-x`.\n\n#### Template variables\n\nHere's what parameters these templates would receive when run:\n\n- ***[docs/docs.twig](https://github.com/adhocore/phint/blob/master/resources/docs/docs.twig):*** classes [metadata](#class-metadata) and [docs parameters](#docs)\n- ***[tests/test.twig](https://github.com/adhocore/phint/blob/master/resources/tests/test.twig):*** class [metadata](#class-metadata) and [test parameters](#test)\n- ***Everything else:*** [init parameters](#init)\n\n***Metadata***\n\n- The `docs` and `test` commands read and use source files metadata.\n- The `docs.twig` template recieves metadata collection of all classes at once.\n- The `test.twig` template recieves metadata unit of one class at a time.\n\n### Class metadata\n\nExample metadata for [Abc\\\\Dummy](#sample-docs) above:\n\n```php\n[\n  'namespace'   =\u003e 'Abc',\n  'classFqcn'   =\u003e 'Abc\\\\Dummy',\n  'classPath'   =\u003e '/home/user/projects/src/Dummy.php',\n  'name'        =\u003e 'Dummy',\n  'className'   =\u003e 'Dummy',\n  'isTrait'     =\u003e false,\n  'isAbstract'  =\u003e false,\n  'isInterface' =\u003e false,\n  'newable'     =\u003e true,\n  'title'       =\u003e 'This is dummy class.',\n  'texts'       =\u003e [\n    'It does nothing as of now.',\n    'Maybe you could fix it?',\n  ],\n  'methods' =\u003e [\n    'alpha' =\u003e [\n      'name'       =\u003e 'alpha',\n      'inClass'    =\u003e 'Abc\\\\Dummy',\n      'isStatic'   =\u003e false,\n      'isFinal'    =\u003e false,\n      'isPublic'   =\u003e true,\n      'isAbstract' =\u003e false,\n      'maybeMagic' =\u003e false,\n      'title'      =\u003e 'Alpha beta.',\n      'texts'      =\u003e [\n        'Example:',\n        '\u003ccode\u003e',\n        '$dummy = new Dummy;',\n        '$dummy-\u003ealpha(\\'john\\', true);',\n        '// \\'...\\'',\n        '\u003c/code\u003e',\n      ],\n      'return' =\u003e 'string|null',\n      'params' =\u003e [\n        'string $name',\n        'bool $flag',\n      ],\n    ],\n    // more methods ...\n  ],\n];\n```\n\n## Todo\n\nIncluding but not limited to:\n\n- [x] README.md/Docs generator\n- [x] Test files generator\n- [x] Support user templates\n- [ ] Test stubs for new methods\n\n## License\n\n\u003e \u0026copy; 2017-2020, [Jitendra Adhikari](https://github.com/adhocore) | [MIT](./LICENSE)\n\n### Credits\n\nThis library is release managed by [please](https://github.com/adhocore/please).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhocore%2Fphint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadhocore%2Fphint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhocore%2Fphint/lists"}