Home / Section index

 PHPLint - Introduction


What is it

PHPLint is a program to validate PHP 5 (targeting 5.6) and PHP 7 (targeting 7.4) source programs written in PHP itself. The result of this validation is a detailed report and possibly a generated documentation about the parsed sources. PHPLint turns a loosely-typed language as PHP into a strongly-typed language. PHPLint may run on any computer for which the PHP interpreter is available, including Linux, Macintosh and Windows. A comprehensive library of general purpose packages and classes named "PHPLint Standard Library" is also included.

Why using the PHPLint validator program

Besides language syntax verification, functions and methods usage verification, and automatic generation of the documentation out of the sources that really matches the behavior of the program, PHPLint may enhance the safety and security of libraries and applications by enforcing strong typed programming, by performing flow analysis on variables usage and statements nesting, by enforcing proper detection and handling of errors, and by tracking the propagation of the checked exceptions though functions and methods.

All this results in an enhanced quality of the sources, shorter debugging and testing times, good documentation and easier maintenance after release, that are the premise for the success of any medium and large application.

Why using the PHPLint Standard Library

The PHPLint validator program uses many of the tools provided by the PHPLint Standard Library, including the errors support module, the class autoloader module, the "magic" cast function, the handy container abstraction classes, the I/O library, and several other tools. But the Standard Library also includes utility libraries, classes and tools that are of general usage in applications, passes the PHPLint validation, and could be used in your applications too. The reference link in the table of contents points to the full documentation generated directly from the sources by PHPLint itself.

What you will need in order to run the PHPLint validator program

Since PHPLint is a PHP program, it requires the PHP command line interpreter (CLI) in order to run; the minimum requirement is PHP 5.6. The package also contains an handy graphical user interface named phplint.tcl that helps in daily usage, so it is highly recommended; in order to run this interface you will need the Tcl interpreter, though. The read-me file explains all in details for Linux and Windows users.

How to start using PHPLint

Download the PHPLint package. Being PHPLint a quite articulated tool, your will need to learn some basic concepts. The tutorial is the first thing you should read; the reference manual is the definitive guide to the features of PHPLint. The standard library, with hundreds of modules and classes, not only provides practical tools you may use in your projects, but also shows examples of the “PHPLint way” of PHP programming. Several articles available in this page also discuss about using IDE, porting of existing sources, web programming techniques and other topics.

Using PHPLint from the command line (click to enlarge). The phpl shell script (phpl.bat under Windows) that comes along with the distributed package, allows to check a PHP source file from the command line.

Using PHPLint from the GUI (click to enlarge). The phplint.tcl program that comes along with the distributed package displays an updated report about the target PHP source file whenever it changes while you are editing and fixing the source; errors and warnings are summarized with colored lines near the scroll bar.

Umberto Salsi
Site map
Home / Section index
Still no comments to this page. Use the Comments link above to add your contribute.