Download the PHP package adhocore/phint without Composer
On this page you can find all versions of the php package adhocore/phint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adhocore/phint
More information about adhocore/phint
Files in adhocore/phint
Package phint
Short Description Initializes new PHP project with sane defaults using templates
License MIT
Informations about the package phint
adhocore/phint
Initializes new PHP project with sane defaults using templates. It scaffolds PHP library &/or project to boost your productivity and save time.
For already existing project, run with --sync
flag to add missing stuffs, see phint init.
Once you have files in your src/
or lib/
you can run phint docs to generate API like documentation in .md
format
and phint test to generate basic test stubs with all the structures already maintained.
It helps you be even more lazier! phint is continuously evolving and the plan is to make it big.
Templating
Phint is powered by adhocore/cli
Installation
Requires PHP7.
Manual
Download phint.phar
from latest release.
And use it like so php /path/to/phint.phar [opts] [args]
. Hmm not cool. See Command section below.
Command
Features
- generate dot files the likes of
.gitignore, .travis.yml, . editorconfig
etc - generate
LICENSE
,README.md
,composer.json
- generate
CHANGELOG.md
stub,CONTRIBUTING.md
guide,ISSUE_TEMPLATE.md
andPULL_REQUEST_TEMPLATE.md
- generate binaries if any
- git init
- interactively ask and install all the dev and prod deps
- generate
phpunit.xml
, testbootstrap.php
- generate test stubs for all classes/methods corresponding to
src
(phint test
) - generate docs for all public class/methods
- export templates to chosen path so it can be customized (
phint export
) - use custom templates from a path specified by user
- update its own self (
phint update
)
Autocompletion
The phint commands and options can be autocompleted if you use zsh shell with oh-my-zsh.
Setting up auto complete:
Dont forget to add ahccli
into plugins=(... ...)
list in ~/.zshrc
file.
Usage
It can be used to quickly spin off new project containing all basic and default stuffs. The quick steps are as follows:
Commands
Each of the commands below should be used like so:
init
alias i
Create and Scaffold a bare new PHP project.
Parameters:
Dont be intimidated by long list of parameters, you are not required to enter any of them as arguments as they are interactively collected when required.
Also check config on how to create a reusable json config so you can use phint
like a pro.
Example config
Parameters sent via command args will have higher precedence than values from config file (-C --config
).
What can you put in config? Anything but we suggest you put only known options (check $ phint init --help
)
update
alias u
Update Phint to lastest version or rollback to earlier locally installed version.
Parameters:
docs
alias d
Generate docs (.md
) for all public classes and methods from their docblocks.
Ideally you would run it on existing project or after you create/update src/
files.
Parameters:
Sample docs
PHP code
Generated Markdown
Preview
Dummy
This is dummy class.
It does nothing as of now. Maybe you could fix it?
alpha()
Alpha beta.
Example:
test
alias t
Generate test files with proper classes and test methods analogous to their source counterparts. If a test class already exists, it is skipped. In future we may append test stubs for new methods.
Ideally you would run it on existing project or after you create/update src/
files.
Parameters:
Sample test
Generated tests/Dummy.php
for Abc\Dummy above:
Templating
phint export --to ~/myphint
So you would like to have your own templates and customize phint
to your taste!
First you need to create a directory root (of any name, eg: myphint
) with structure that looks like:
Note 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.
Luckily you dont have to create these templates yourself, just run phint export --to ~/myphint
!
Pro Tip
You can actually introduce any new template as long as their extension is .twig
.
Such templates are only used by phint init
command. Check Template variables.
After you are done customizing these templates you can use them in each of the phint commands like so
The short option name for --template
is -x
.
Template variables
Here's what parameters these templates would receive when run:
- docs/docs.twig: classes docs parameters
- tests/test.twig: class test parameters
- Everything else: init parameters
Metadata
- The
docs
andtest
commands read and use source files metadata. - The
docs.twig
template recieves metadata collection of all classes at once. - The
test.twig
template recieves metadata unit of one class at a time.
Class metadata
Example metadata for Abc\Dummy above:
Todo
Including but not limited to:
- [x] README.md/Docs generator
- [x] Test files generator
- [x] Support user templates
- [ ] Test stubs for new methods
License
© 2017-2020, Jitendra Adhikari | MIT
Credits
This library is release managed by please.
All versions of phint with dependencies
adhocore/cli Version ^0.8.1
adhocore/json-comment Version ^0.1
crazyfactory/docblocks Version ^2.2
symfony/finder Version ^3.3.0
twig/twig Version ^2.4.0