search
HomeBackend DevelopmentPHP TutorialSublime Text3 builds PHP development environment

This article mainly shares with you about setting up a PHP development environment with Sublime Text3. Interested friends can refer to it

1.Sublime text3 installation

Go to the official website http://www.sublimetext.com/ to download Sublime text3. After downloading, click Install and keep clicking Next.

2. Install Package Control

You need to install Package Control before installing other plug-ins

Method 1.Ctrl ` shortcut key or through View->Show Console menu opens the command line, enter the relevant code copied at https://packagecontrol.io/installation and paste it into the console.

Method 2. I failed to install through method 1, so I installed it manually:

First go to https://packagecontrol.io/installation to download Package Control.sublime-package,

Then, click Preferences -> Browse Packages menu-> Enter the upper directory of the opened directory C:\Users\……\……\Sublime Text 3-> and then enter the Installed Packages/ directory ->Put the downloaded Package Control.sublime-package into the Installed Packages/ directory ->Restart Sublime Text.

If the installation is successful, you can see the Package Settings and Package Control menus under the Preferences menu.

3. Start installing the plug-in

Open Package Control through the shortcut key Ctrl Shift P, enter pic and click Package Control:Install Pcakage

Next step: Enter the plug-in you need to install in the input box that appears

I mainly install the following plug-ins:


1.Aligment Automatic alignment

##Since Ctrl Alt A may conflict with the shortcut key of an IM screenshot, the method to modify the Sublime Text 2 shortcut key is as follows:

Open Preferences=>Package Settings=>Alignment=>Key Binding - User and write

[ { "keys": ["ctrl alt l"], "command" : "alignment" }]

Aligment details https://blog.csdn.net/sugang_ximi/article/details/48464253

2.Bracket Highlighter is used to match brackets, quotes and html tags. Useful for very long codes. After installation, the plug-in will automatically take effect without setting up

##3.

ConvertToUTF8 Plug-in that supports UTF-8 encoding

4.DocBlockr

DocBlockr can automatically generate PHPDoc style comments. The languages ​​it supports include Javascript, PHP, ActionScript, CoffeeScript, Java, Objective C, C, C 5.Emmet(Zen Coding)
A plug-in that quickly generates HTML code snippets. It is unparalleledly powerful. If you know, please google

6.Side Bar Enhancements

This plug-in improves the sidebar and adds many functions. Open the configuration reference in the browser: http://www.cnblogs.com/jikey/archive/2013/03/12/2955230.html


##7.

Themr Theme management, when switching themes, you don’t need to modify the configuration file yourself. You can use this to switch themes conveniently8.CTags

Different file functions Jump between. http://ctags.sourceforge.net/

After downloading CTags, unzip it, then configure the environment variable path, WIN R key and enter sysdm.cpl environment to open the system properties (you can also right-click on the computer -> Properties ->Advanced System Configuration) Select Advanced->Environment Variables, and then set the CTags executable program path to the environment variable path. In the command line (console) under the window, cd to the root directory of the project where the plug-in needs to be used, enter ctags -R -f .tags, and a .tags file will be generated in the project root directory, and the jump can be realized . (Jump back and forth shortcut keys: crtl left mouse button/crtl right mouse button)

9.Php Code Sniffer

Code specification prompt plug-in

10.phpfmt

Format PHP code

Automatically format the Preferences->Browse Packages->phpfmt.sublime-settings file when saving the configuration, and change its content to:

{"version": 4,"php_bin":"D:/wamp64/bin/php/php7.1.16/php.exe",//填写你的php.exe的地址"format_on_save":true,"option": "value"}

11.SublimeTmpl Quickly generate file templates


SublimeTmpl can create new html and css There are six types of file templates: javascript, php, python, and ruby. All file templates are in the templates folder of the plug-in directory. You can customize and edit the file templates.

SublimeTmpl default shortcut keys

  • ctrl alt h → html

  • ##ctrl alt j → javascript

  • ctrl alt c → css

  • ctrl alt p → php

  • ctrl alt r → ruby

  • ctrl alt shift p → python


##4. Create a PHP compilation system

Add PHP build system, as shown in the figure, Tools->Build System-> New Build System:

Create a new one, the default content is: { "shell_cmd": "make"} Modify to: { "cmd": ["php", "$file"], "file_regex": "php$", "selector": "source.php" } Save it in the default directory, pay attention to modifying the file Named php.sublime-build. Restart sublime text and you can use Ctrl B to compile the .php file;

5. General shortcut keys


Select class

Ctrl D selects the text occupied by the cursor. If you continue to operate, the next same text will be selected.

Alt F3 Select text and press the shortcut key to select all the same text at once for editing at the same time. For example: quickly select and change all the same variable names, function names, etc.

Ctrl L selects the entire line. If you continue the operation, you will continue to select the next line. The effect is the same as Shift ↓.
Ctrl Shift L First select multiple lines, and then press the shortcut key. The cursor will be inserted at the end of each line, and you can edit these lines at the same time.
Ctrl Shift M Select the content within the brackets (continue to select the parent brackets). For example: quickly select to delete the code in the function, rewrite the function body code or rewrite the content inside the brackets.
Ctrl M Move the cursor to the end or beginning position within the brackets.
Ctrl Enter inserts a new line on the next line. For example: even if the cursor is not at the end of the line, you can quickly insert a line downwards.
Ctrl Shift Enter inserts a new line on the previous line. For example: even if the cursor is not at the beginning of the line, you can quickly insert a line upwards.
Ctrl Shift [Select the code, press the shortcut key, and collapse the code.
Ctrl Shift ] Select the code and press the shortcut key to expand the code.
Ctrl K 0 Expand all folded codes.
Ctrl ← Move the cursor unitarily to the left and move the cursor quickly.
Ctrl → Move the cursor unitarily to the right and move the cursor quickly.
shift ↑ Select multiple lines upward.
shift ↓ Select multiple lines downwards.
Shift ← Select text to the left.
Shift → Select text to the right.
Ctrl Shift ← Select text unitarily to the left.
Ctrl Shift → Select text unitarily to the right.
Ctrl Shift ↑ Swap the line where the cursor is and the previous line of code (insert the line where the cursor is before the previous line).
Ctrl Shift ↓ Swap the line where the cursor is and the next line of code (insert the line where the cursor is after the next line).
Ctrl Alt ↑ Add multi-line cursor upward to edit multiple lines at the same time.
Ctrl Alt ↓ Add multi-line cursor downwards and edit multiple lines at the same time.

Edit Class


Ctrl J merges the selected multiple lines of code into one line. For example: merge CSS properties in multi-line format into one line.

Ctrl Shift D Copy the entire line where the cursor is and insert it into the next line.

Tab indents to the right.
Shift Tab indents to the left.
Ctrl K K Delete code from the cursor to the end of the line.
Ctrl Shift K deletes the entire line.
Ctrl / Comment single line.
Ctrl Shift / Comment multiple lines.
Ctrl K U Convert to uppercase.
Ctrl K L Convert to lowercase.
Ctrl Z Undo.
Ctrl Y Undo.
Ctrl U soft undo, feels the same as Gtrl Z.
Ctrl F2 Set bookmark
Ctrl T Swap left and right letters.
F6 Word detection spelling

Search category

Ctrl F Open the search box at the bottom and search for keywords.
Ctrl shift F Search within a folder. The difference from ordinary editors is that sublime allows you to add multiple folders for search. It is slightly advanced and has not been studied yet.
Ctrl P opens the search box. For example: 1. Enter the file name in the current project to quickly search the file. 2. Enter @ and keywords to find the function name in the file. 3. Enter: and a number to jump to the line of code in the file. 4. Enter # and keywords to find variable names.
Ctrl G opens the search box, automatically with:, enter the number to jump to the line of code. For example: quickly locate files with long page codes.
Ctrl R Open the search box, automatically add @, enter keywords to find the function name in the file. For example: quickly search for a function on a page with many functions.
Ctrl: Open the search box, automatically add #, enter keywords, and search for variable names, attribute names, etc. in the file.
Ctrl Shift P opens the command box. Scenario example: Open the naming box, enter keywords, and call the function of sublime text or plug-in, such as using package to install the plug-in.
Esc exits cursor multi-line selection, exits search box, command box, etc.
Display class

Ctrl Tab switches the tabs of the current window in the order in which the files have been browsed.
Ctrl PageDown Switch the tab page of the current window to the left.
Ctrl PageUp Switch the tab page of the current window to the right.
Alt Shift 1 window split screen, restore the default 1 screen (non-keypad numbers)
Alt Shift 2 left and right split screen - 2 columns
Alt Shift 3 left and right split screen - 3 columns
Alt Shift 4 Left and right split screen - 4 columns
Alt Shift 5 Equally divided screen 4
Alt Shift 8 Vertical split screen - 2 screens
Alt Shift 9 Vertical split screen - 3 screens
Ctrl K B Turn on/off side Sidebar.
F11 Full screen mode
Shift F11 Do not disturb mode

Related recommendations:

Standard version of Eclipse steps to build a PHP environment

How to build a php running environment under Ubuntu server_Linux



The above is the detailed content of Sublime Text3 builds PHP development environment. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor