The PHP Plugin
As of CodeLite 7.0, PHP support in CodeLite has been extended to provide a fully workable PHP environment for editing and building a PHP application or a simple website.
The PHP plugin supports (but is not limited to) the following:
- Code Completion
- Debugging capabilities via XDebug
- Syntax checking
- Simplified project management
- Class wizard
- Remote synchronizing over SFTP
The Workspace file
Unlike a standard workspace in CodeLite, a PHP workspace uses its own tab in the IDE, named "PHP" in the "Workspace View" pane on the left side.
CodeLite's PHP workspace contains the following information:
- List of project files (will be discussed later)
- Metadata (workspace file format version and other info needed by CodeLite)
Only one workspace can be loaded at a time within CodeLite; however, each workspace may contain multiple projects.
Each workspace is represented on the file system as a single file with the extension
The Project files
Each PHP project corresponds to a real directory on the file system (i.e. there are no Virtual Directories as there are with standard C++ CodeLite projects).
A project may contain subfolders, each corresponding to a dir in the matching position on the file system. However you don't have to include every real dir; you may define filters to define which dirs and files you wish to view (e.g.
.svn etc) in the project settings.
Projects can't be nested: a project tree can't contain another project.
Create your first workspace
Creating a PHP workspace is done by clicking on the New Workspace button in the Welcome Page (or from the menu: File -> New -> New Workspace )
- Click on the New Workspace button.
- Select PHP as the workspace type (at the time of writing this, CodeLite supports two types of workspace: C++ and PHP)
- Fill the workspace details
- The workspace name - give your workspace a meaningful name
- Select the workspace location (i.e. where should CodeLite create the workspace file)
- Optionally: you may choose to create the workspace under a new folder
- Now that the workspace file has been created. We can start adding projects to it. We do this, by right clicking on the workspace icon and selecting the menu entry Create a new project
- Follow the new project wizard. At the moment, CodeLite offers to create 2 types of project: an empty project or a project from an existing source files. In this short tutorial, I have chosen the option to create an empty project.
- Now that you have your wrokspace and project setup, lets create a simple "Hello World" example:
- Right click on the project and select New Class
- Click OK and edit the
MyClass by adding a simple
- Run the project by hitting
Ctrl-F5 or Right clicking the project and selecting