Download the PHP package memio/spec-gen without Composer
On this page you can find all versions of the php package memio/spec-gen. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package spec-gen
Memio's SpecGen
This extension for phpspec provides a powerful code generator:
- method generation:
- it inserts method at the end of the class
- it typehints arguments (uses interface when possible)
- it names object arguments after their type (strips
Interface
suffix from names) - it names scalar arguments after a generic name (
argument
) - it adds number on names that could collide (e.g.
$argument1, $argument2
)
- constructor generation, same as method except:
- it inserts constructor at the begining of the class
- it inserts properties with initialization for each constructor arguments
Note: Currently it is not possible to provide custom templates to SpecGen (it is not compatible with phpspec templates).
Installation
First install it using Composer:
Then enable it in phpspec.yml
:
Version guide:
- using phpspec 5? Then use spec-gen v0.9
- using phpspec 4? Then use spec-gen v0.8
- using phpspec 3 and PHP 7? Then use spec-gen v0.7
- using phpspec 3 and PHP 5.6? Then use spec-gen v0.6
- using phpspec 2? Then use spec-gen v0.4
Full example
Let's write the following specification:
Executing the specifications (phpspec run
) will generate the following class:
Now we can start naming those generic arguments and write the code.
Want to know more?
You can see the current and past versions using one of the following:
- the
git tag
command - the releases page on Github
- the file listing the changes between versions
And finally some meta documentation:
- copyright and MIT license
- versioning and branching models
- contribution instructions
Roadmap
- constructor property promotion
- return type hints
- method body (mirror of test method body)
- better scalar argument naming (based on names used in test)
All versions of spec-gen with dependencies
memio/memio Version ^2.0
memio/linter Version ^2.0
memio/validator Version ^2.0
memio/model Version ^2.0.1
memio/pretty-printer Version ^2.0
memio/twig-template-engine Version ^2.0.1
php Version ^7.2
phpspec/phpspec Version ^6.1
symfony/event-dispatcher Version ^5.0