├── LICENSE.md ├── README.md ├── license-mit.sublime-snippet ├── license-newbsd.sublime-snippet ├── php-getset.sublime-snippet ├── php-mit.sublime-snippet ├── php-newbsd.sublime-snippet └── php-section-comment.sublime-snippet /LICENSE.md: -------------------------------------------------------------------------------- 1 | New BSD License 2 | =============== 3 | 4 | Copyright (c) 2012, Stuart Herbert and contributors 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * Neither the names of the copyright holders nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Additional PHP Snippets For Sublime Text 2 2 | ========================================== 3 | 4 | [Sublime Text 2](http://www.sublimetext.com/2) already ships with a lot of snippets for writing PHP code. This is a collection of additional snippets contributed by the PHP community. 5 | 6 | Installation 7 | ------------ 8 | 9 | Use Sublime Text 2's [Package Control](http://wbond.net/sublime_packages/package_control) (Preferences -> Package Control -> Install Package -> Additional PHP Snippets) to install this plugin. 10 | 11 | Snippets 12 | -------- 13 | 14 | We add the following snippets to speed up writing PHP code. 15 | 16 | To use any of the snippets, simply type the name of the snippet, then press the key. Sublime Text 2 will insert the snippet, and you can then use the key to move through any placeholders that you need to replace. 17 | 18 | __For LICENSE.md-type files:__ 19 | 20 | * __license-mit__: insert the MIT license 21 | * __license-newbsd__: insert the new BSD license 22 | 23 | __ For PHP files:__ 24 | 25 | * __php-getset__: create getter/setter methods quickly and easily (based on a snippet originally published by @akrabat) 26 | * __php-mit__: insert the MIT license as a PHP docblock 27 | * __php-newbsd__: insert the new BSD license as a PHP docblock 28 | * __php-section-comment__: insert a prominent comment to help break up the sections of your class 29 | 30 | Contributions Welcome 31 | --------------------- 32 | 33 | Requests for features, and pull requests with patches, are most welcome :) 34 | -------------------------------------------------------------------------------- /license-mit.sublime-snippet: -------------------------------------------------------------------------------- 1 | 13 | 14 | 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a 22 | copy of this software and associated documentation files (the "Software"), 23 | to deal in the Software without restriction, including without limitation 24 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 25 | and/or sell copies of the Software, and to permit persons to whom the 26 | Software is furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in 29 | all copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 34 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 36 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 37 | DEALINGS IN THE SOFTWARE. 38 | ]]> 39 | 40 | license-mit 41 | 42 | Add the MIT license to a plain text file 43 | -------------------------------------------------------------------------------- /license-newbsd.sublime-snippet: -------------------------------------------------------------------------------- 1 | 13 | 14 | 46 | 47 | license-newbsd 48 | 49 | Add New BSD license to a plain text file 50 | -------------------------------------------------------------------------------- /php-getset.sublime-snippet: -------------------------------------------------------------------------------- 1 | 25 | 26 | ${1:[ Prop name ]}; 35 | } 36 | 37 | /** 38 | * ${5:[Description]} 39 | * 40 | * @param ${3/(.*)/\u$1/:[type]} \$new${1:[ Prop name ]} ${4/(.*)/\u$1/:[description]} 41 | */ 42 | public function set${1/(.*)/\u$1/:[ Prop name ]}(\$${1/(.*)/$1/:[ Prop name ]}) { 43 | \$this->${1:[Prop name ]} = \$${1/(.*)/$1/:[ Prop name ]}; 44 | 45 | return \$this; 46 | } 47 | ]]> 48 | 49 | php-getset 50 | 51 | source.php 52 | 53 | Create getter and setter methods 54 | 55 | -------------------------------------------------------------------------------- /php-mit.sublime-snippet: -------------------------------------------------------------------------------- 1 | 14 | 15 | 21 | * 22 | * Permission is hereby granted, free of charge, to any person obtaining 23 | * a copy of this software and associated documentation files (the 24 | * "Software"), to deal in the Software without restriction, including 25 | * without limitation the rights to use, copy, modify, merge, publish, 26 | * distribute, sublicense, and/or sell copies of the Software, and to 27 | * permit persons to whom the Software is furnished to do so, subject to 28 | * the following conditions: 29 | * 30 | * The above copyright notice and this permission notice shall be included 31 | * in all copies or substantial portions of the Software. 32 | * 33 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 34 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 35 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 36 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 37 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 38 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 39 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 40 | * 41 | * @category ${3:[ Category ]} 42 | * @package ${4:[ Package ]} 43 | * @subpackage ${5:[ Subpackage ]} 44 | * @author ${1:[ Your name ]} <${2:[ [Your email ]}> 45 | * @copyright 2012 ${1:[ Your name ]}. 46 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 47 | * @version ${6:[ Version ]} 48 | * @link http://${7:[ Your website ]} 49 | */ 50 | ]]> 51 | 52 | php-mit 53 | 54 | source.php 55 | 56 | Insert the MIT license DocBlock 57 | 58 | -------------------------------------------------------------------------------- /php-newbsd.sublime-snippet: -------------------------------------------------------------------------------- 1 | 14 | 15 | 52 | * @copyright 2012 ${1:[ Copyright holder ]}. 53 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License 54 | * @link http://${6:[ Your website ]} 55 | * @version @@PACKAGE_VERSION@@ 56 | */ 57 | ]]> 58 | 59 | php-newbsd 60 | 61 | source.php 62 | 63 | Insert New BSD license DocBlock 64 | -------------------------------------------------------------------------------- /php-section-comment.sublime-snippet: -------------------------------------------------------------------------------- 1 | 15 | 16 | 24 | 25 | php-section-comment 26 | 27 | source.php 28 | 29 | Insert a comment block at the start of a new section in your PHP class 30 | 31 | --------------------------------------------------------------------------------