PHP Development

2012 年 11 月 18 日7460

PHP Development

src="../../images_www/v7/screenshots/php-cut.png"

alt="PHP development in NetBeans IDE">

Click image for full screen preview

A dedicated PHP coding environment and complete integration

with web standards.

PHP Source Code Editor

improved

The NetBeans PHP editor offers code templates and code generation

(Getters and Setters), refactoring (Instant Rename), parameter

tooltips, hints and quick fixes (Implement All Abstract Methods), and

smart code completion (including bracket completion). Benefit from

syntactic and semantic code highlighting, pop-up documentation, code

formating and folding, marking of occurrences and exit points, clever try/catch code completion, smart method parameter pre-filling, and rectangular selection.

In NetBeans IDE 7.2, the PHP code editor features new Unused Use Statement and Immutable Variable hints, annotation support, improved code folding, and improved code coloring.

For more information about improvements to the PHP Editor, see the NetBeans for PHP blog.

alt="Menu item for generating PhpDoc">

PHP 5.4 Support

New feature

NetBeans IDE for PHP 7.2 offers a number of features specific to

developing with PHP 5.4. You can set up your PHP 5.4 project to run on PHP 5.4's built-in web server. The IDE's PHP code completion supports PHP 5.4 array styles such as array dereferencing and short array syntax. NetBeans IDE also recognizes Traits and anonymous object variables (also called "fluent instantiation"). Finally, NetBeans IDE for PHP 7.2 includes minor features such as callable type hints, binary notation for integers, and Class::{expr}() invocation.

Anonymous object variable code completion

Continuous Integration Support

New feature

NetBean IDE for PHP 7.2 introduces support for continuous integration. Continuous integration is a software development practice involving version control and a specialized server. The specialized server runs scheduled PHPUnit and Code Coverage tests on the software. Test results are associated with version control information, so developers can identify bugs they introduce to the software quickly and easily. NetBeans usesTemplate for Jenkins Jobs for PHP Projects, which must be set up with the necessary plugins and tools on the integration server.

Support for PHP on Continuous Build Servers

Starting build job on server

PHP Projects

The NetBeans project offers a version of the IDE tailor-made

for developing PHP web sites that comprise a variety of scripting and

mark-up languages. The PHP editor is dynamically integrated with HTML,

JavaScript and CSS editing features.

Focus on the code and speed up code scanning by excluding

individual directories in the Project properties. The NetBeans IDE

fully supports iterative development, so testing PHP projects follows

the classic patterns familiar to web developers.

projects window

PHP Files Without Projects

You can edit, run or debug PHP files

that are

not in a PHP project. Open the file and press SHIFT-F6 to run the file.

Open the file and press CTRL-SHIFT-F5 to debug the file. In either

case, a dialog opens in which you can provide script run arguments,

change the working directory, or specify PHP options.

src=""

alt="NetBeans dialog for running a PHP file outside of a PHP project">

Easy Code Navigation

Use the navigator window or the Go To Type, Go To File, Go To

Symbol, Go To Declaration, Find Usages menu items for easy code

navigation in large projects. The editor warns about potential code

problems by flagging them and giving an hint in a pop-up. A tasks

window lists all warnings in the project, making it easy to find and

resolve problems.

alt="Easy PHP code navigation">

Framework Support

improved

NetBeans IDE supports many popular PHP frameworks. NetBeans IDE 7.2 introduces Doctrine2 support and mature Symfony 2 with Twig template support, along with a plugin for preliminary Neon support. The IDE provides code completion and recognizes the syntax of these frameworks as well as the Zend and original Symfony frameworks and Smarty template files. Filter and view help for Zend, Symfony, or Doctrine2 commands, specify

command parameters, preview the whole command, and run it. You can also

assign shortcuts to commands.

Zend Framework

Support

Symfony Support

Doctrine2 Support

Smarty Support

src=""

alt="NetBeans supports the PHP frameworks Zend and Symfony">

PHP Debugging

Debug PHP code using Xdebug: You can inspect local variables,

set watches, set breakpoints, and evaluate code live. Navigate to

declarations, types and files using Go To shortcuts and hypertext

links. Use a global PHP include path for all projects or customize it

per project.

The NetBeans IDE for PHP also offers command-line debugging:

The PHP program output appears in a command line display in the IDE

itself and you can inspect the generated HTML without having to switch

to a browser.

You can debug scripts and web pages, either locally or

remotely. The NetBeans PHP debugger integration allows you to map

server paths to local paths to enable remote debugging.

All debugging options can be found under their own tab in Options.

alt="NetBeans PHP debugger watches">

Continuous Integration Support

New feature

Remote and Local Project Development

improved

PHP projects can easily be deployed from within NetBeans IDE

to local or remote servers via FTP or SFTP. You can easily create

a new project from remote sources, and the IDE will upload your changes

automatically when you save a file. Run the project as a local web

site, as a command line script, or as a remote web application via FTP

or SFTP. (S)FTP support includes lazy file loading, keep-alive, and FTP over TLS/SSL.

NetBeans IDE 7.2 introduces remote synchronization, where you can check your version of a PHP file against the version on a remote server. See Deploying a PHP Application on a Remote Web Server for more information.

Note: NetBeans provides basic support for FTP/SFTP, sufficient for a lone developer to work on a simple project. If you are working on a complex project or with multiple developers, you should use a version control system. The IDE also supports a range of version control systems, including CVS, SVN, Git, and Mercurial. For more information about NetBeans IDE's version control support, please see Version Control & Developer Collaboration.

alt="NetBeans PHP - FTP configuration">

PHP Unit Testing

improved

Create PHPUnit tests and Selenium test cases for files or

folders, run tests, and view test results. You can define test groups to selectively run unit test upon. In the PHPUnit properties

you can define a custom XML configuration file, a bootstrap file for

command line options, or a custom test suite, or you can let the IDE

generate skeleton code for you. Use a keyboard shortcut to navigate

quickly between test and tested class.

NetBeans IDE 7.2 introduces support for PHPUnit Skeleton Generator and for project-specific PHPUnit scripts.

Testing

with PHPUnit and Selenium

alt="NetBeans PHPUnit test results">

Code Coverage

Generate a Code Coverage report for PHP files to see how well

your test cases cover your code: Covered statements are marked green in

the editor, statements that haven't been executed during the test are

marked red. The evaluation is based on the number of executable

statements, lines with white space and comments do not distort the

result.

alt="NetBeans PHP code coverage">

Namespace and Variable Types

improved

The PHP editor understands namespaces and variable type

definitions in comments which improves code completion and hyperlink

navigation. The Editor recognizes PHP code including heredoc notation

in PHP projects and in PHTML, YAML, and PHP files, including the latest

PHP 5.4.

NetBeans IDE 7.2 adds the Fix Uses... action. Right click inside a namespace and selectFix Uses..., and the IDE goes through your code and tries to resolve missing use statements.

PHP

Namespace Support

Fix Uses action

MySQL Integration

PHP developers can also look forward to working with MySQL.

The Insert Code command provides a Database Table option that creates

the code needed to execute a SELECT statement in MySQL. Open a window

to make changes to MySQL tables, select individual table cells with the

mouse, and edit them directly.

alt="NetBeans PHP - FTP configuration" >

Documenting PHP Code with ApiGen

improved

You can use NetBeans PHP IDE to generate PHP code

documentation with ApiGen. You must download ApiGen

yourself and make certain in the IDE Options that the IDE recognizes

the ApiGen installation and that the IDE has found the correct

path to the ApiGen script. After you set everything up

correctly, all you have to do is right-click a project node and select

Generate Documentation. The IDE generates the ApiGen files in the location of

your choice.

Note: ApiGen replaces PHPDocumentor as the preferred documentation tool for NetBeans IDE. ApiGen fully supports PHP 5.3 and includes experimental support for PHP 5.4 Traits.

You can install a plugin to use PHPDocumentor if you prefer it to ApiGen.

Generate documentation feature

PHP Learning

Trail

NetBeans

PHP

Blog

0 0