- Saved searches
- Use saved searches to filter your results more quickly
- r4ven1245/vscode-php-getter-setter
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- PHP getters and setters for Visual Studio Code
- Extension Settings
- Custom Templates
- Release Notes
- 1.2.0
- 1.1.0
- 1.0.5
- Saved searches
- Use saved searches to filter your results more quickly
- phproberto/vscode-php-getters-setters
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- PHP getters and setters for Visual Studio Code
- Features
- Extension Settings
- Custom Templates
- Release Notes
- 1.2.0
- 1.1.0
- 1.0.5
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
r4ven1245/vscode-php-getter-setter
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
PHP getters and setters for Visual Studio Code
Fast generator of getters and setters for your PHP class properties.
This is based off of @phproberto’s extension that has not been updated for 3 years.
I removed custom template features and all of the configuration options. It’s a simple extension doing a simple job.
I’ve updated the extension to work with PHP type hinting.
Make sure to reload VS Code after installing and/or changing the settings.
This extension allows you to quickly generate getters and setters with one single command.
It adds 3 comands to vscode’s command palette:
This extension contributes the following settings:
- phpGetterSetter.short : Shorten Getter and Setter to be one line each. Default: false
- phpGetterSetter.redirect : Redirect to generated functions after creating them. Default: false
- Support for static properties
- Readded the legacy configuration option to stop the cursor from moving to the generated methods
PHP getters and setters for Visual Studio Code
You can also access commands from contextual menu when clicking on a class property:
Extension Settings
This extension contributes the following settings:
- phpGettersSetters.spacesAfterParam : Number of spaces to insert between @param tag and variable name in doc blocks. Default: 2
- phpGettersSetters.spacesAfterParamVar : Number of spaces to insert after the variable name in the @param tag line. Default: 2
- phpGettersSetters.spacesAfterReturn : Number of spaces to insert after the @return tag. Default: 2
- phpGettersSetters.redirect : Redirect editor to generated functions after generating them? Default: true
- phpGettersSetters.templatesDir : Folder where custom templates are stored
- phpGettersSetters.getterTemplate : File to use as template for getters. Default: getter.js
- phpGettersSetters.setterTemplate : File to use as template for setters. Default :setter.js
Custom Templates
By default this extension will use a custom function to generate your getters & setters but you can fully customise the markup used to generate them. By default templates are stored in:
- Linux: ~/.config/Code/User/phpGettersSetters
- OSX: ~/Library/Application Support/Code/User/phpGettersSetters
- Windows: Users\\AppData\Roaming\Code\User\phpGettersSetters
You can also set a custom templates dir entering a custom folder in phpGettersSetters.templatesDir setting.
Template Literals are used for templating because the flexibility they provide. With them you can easily create a custom template with no knowledge and also invest some time for complex things. For advanced usage you will have to google about template literals but here are 2 sample templates.
module.exports = (property) => ` /** * $ * * @return $ */ public function $() < return $this->$; > `
module.exports = (property) => ` /** * $ * * @param $ \$$ $ * * @return self */ public function $($\$$) < $this->$ = \$$; return $this; > `
As you can see a Property object is passed to templates so you can access any public method there. I also like the idea of adding more stuff as users find limits. Open an issue if you find something you cannot achieve.
Release Notes
1.2.0
1.1.0
1.0.5
- Fixed No property found when switching between editors. Thanks for reporting Carlos Alfonso Pérez Rivera!
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
phproberto/vscode-php-getters-setters
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Use windows environment variable %APPDATA% in custom template section
Git stats
Files
Failed to load latest commit information.
README.md
PHP getters and setters for Visual Studio Code
Fast generator of getters and setters for your PHP class properties.
This extension allows you to quickly generate getters and setters with one single command.
- Detects indentation. No matter if you use spaces or tabs.
- Uses configuration options to show doc blocks as you like them.
- Generates method’s descriptions based on the property description.
- Detects valid type hints to use them in the setter.
It adds 3 comands to vscode’s command palette:
You can also access commands from contextual menu when clicking on a class property:
This extension contributes the following settings:
- phpGettersSetters.spacesAfterParam : Number of spaces to insert between @param tag and variable name in doc blocks. Default: 2
- phpGettersSetters.spacesAfterParamVar : Number of spaces to insert after the variable name in the @param tag line. Default: 2
- phpGettersSetters.spacesAfterReturn : Number of spaces to insert after the @return tag. Default: 2
- phpGettersSetters.redirect : Redirect editor to generated functions after generating them? Default: true
- phpGettersSetters.templatesDir : Folder where custom templates are stored
- phpGettersSetters.getterTemplate : File to use as template for getters. Default: getter.js
- phpGettersSetters.setterTemplate : File to use as template for setters. Default :setter.js
By default this extension will use a custom function to generate your getters & setters but you can fully customise the markup used to generate them. By default templates are stored in:
- Linux: ~/.config/Code/User/phpGettersSetters
- OSX: ~/Library/Application Support/Code/User/phpGettersSetters
- Windows: %APPDATA%\Code\User\phpGettersSetters
You can also set a custom templates dir entering a custom folder in phpGettersSetters.templatesDir setting.
Template Literals are used for templating because the flexibility they provide. With them you can easily create a custom template with no knowledge and also invest some time for complex things. For advanced usage you will have to google about template literals but here are 2 sample templates.
module.exports = (property) => ` /** * $ * * @return $ */ public function $() < return $this->$; > `
module.exports = (property) => ` /** * $ * * @param $ \$$ $ * * @return self */ public function $($\$$) < $this->$ = \$$; return $this; > `
As you can see a Property object is passed to templates so you can access any public method there. I also like the idea of adding more stuff as users find limits. Open an issue if you find something you cannot achieve.
PHP getters and setters for Visual Studio Code
This repository is a fork of the original extension phproberto/vscode-php-getters-setters
Unfortunately, its author doesn’t seems to have time to maintain it anymore, so I made this fork to make the extension working again with the last version of VSCode and to merge the work from its amazing contributors. Feel free to submit issues or pull requests, and thanks @phproberto for its work !
Features
- Detects indentation. No matter if you use spaces or tabs.
- Uses configuration options to show doc blocks as you like them.
- Generates method’s descriptions based on the property description.
- Detects valid type hints to use them in the setter.
It adds 3 comands to vscode’s command palette:
You can also access commands from contextual menu when clicking on a class property:
Extension Settings
This extension contributes the following settings:
- phpGettersSetters.spacesAfterParam : Number of spaces to insert between @param tag and variable name in doc blocks. Default: 2
- phpGettersSetters.spacesAfterParamVar : Number of spaces to insert after the variable name in the @param tag line. Default: 2
- phpGettersSetters.spacesAfterReturn : Number of spaces to insert after the @return tag. Default: 2
- phpGettersSetters.redirect : Redirect editor to generated functions after generating them? Default: true
- phpGettersSetters.templatesDir : Folder where custom templates are stored
- phpGettersSetters.getterTemplate : File to use as template for getters. Default: getter.js
- phpGettersSetters.setterTemplate : File to use as template for setters. Default :setter.js
Custom Templates
By default this extension will use a custom function to generate your getters & setters but you can fully customise the markup used to generate them. By default templates are stored in:
- Linux: ~/.config/Code/User/phpGettersSetters
- OSX: ~/Library/Application Support/Code/User/phpGettersSetters
- Windows: %APPDATA%\Code\User\phpGettersSetters
You can also set a custom templates dir entering a custom folder in phpGettersSetters.templatesDir setting.
Template Literals are used for templating because the flexibility they provide. With them you can easily create a custom template with no knowledge and also invest some time for complex things. For advanced usage you will have to google about template literals but here are 2 sample templates.
module.exports = (property) => ` /** * $ * * @return $ */ public function $() < return $this->$; > `
module.exports = (property) => ` /** * $ * * @param $ \$$ $ * * @return self */ public function $($\$$) < $this->$ = \$$; return $this; > `
As you can see a Property object is passed to templates so you can access any public method there. I also like the idea of adding more stuff as users find limits. Open an issue if you find something you cannot achieve.
Release Notes
1.2.0
1.1.0
1.0.5
- Fixed No property found when switching between editors. Thanks for reporting Carlos Alfonso Pérez Rivera!