PHP Constructors
Sublime plugin to auto generate PHP constructors based on the class attributes
Details
Installs
- Total 26K
- Win 19K
- Mac 2K
- Linux 4K
Jun 6 | Jun 5 | Jun 4 | Jun 3 | Jun 2 | Jun 1 | May 31 | May 30 | May 29 | May 28 | May 27 | May 26 | May 25 | May 24 | May 23 | May 22 | May 21 | May 20 | May 19 | May 18 | May 17 | May 16 | May 15 | May 14 | May 13 | May 12 | May 11 | May 10 | May 9 | May 8 | May 7 | May 6 | May 5 | May 4 | May 3 | May 2 | May 1 | Apr 30 | Apr 29 | Apr 28 | Apr 27 | Apr 26 | Apr 25 | Apr 24 | Apr 23 | Apr 22 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 4 | 2 | 0 | 0 | 0 | 1 | 2 | 0 | 0 | 1 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- bitbucket.org
PHP Constructors
PHP Constructors generates for you PHP Classes constructors.
Features:
- Generate class constructor
- Description, type and var name automatically discovered from the variable docblock.
Usage Instruction:
- Write your class properties inside your PHP class:
class test
{
/**
* @var my\long\namespace Var that holds foo
*/
private $foo;
}
- Go to Tools -> PHP Constructor
- Constructor will be generated
class test
{
/**
* @var my\long\namespace Var that holds foo
*/
private $foo;
/**
* Class Constructor
* @param my\long\namespace $foo Var that holds foo
*/
public function __construct($foo)
{
$this->foo = $foo;
}
}
Take sometime to document your class properties with the following format:
class test
{
/**
* @var varType Description of the var
*/
private $foo;
}
Commands
Commands available are:
- Generate Constructor for Class
This option can be accessed via the contextual menu (right click) or on the command palette.
Available Settings
optional_constructor_params
type : boolean
default: false
description: If set to true generated constructor will be generated with optional parameters.