Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Knp University:
Fun with Symfony's Console Component
Oct 06, 2015 @ 15:26:41

In a post to the Knp University blog they show you some of the fun you can have with the Symfony Console component in a single file including a few lesser known (and lesser used) features.

One of the best parts of using Symfony's Console component is all the output control you have to the CLI: colors, tables, progress bars etc. Usually, you create a command to do this. But what you may not know is that you can get to all this goodness in a single, flat PHP file.

They walk you through the creation of a ConsoleOutput object with a simple writeln output of a formatted method. They briefly mention the handling for changing up the output (OutputFormatter and OutputFormatterStyle) before getting into something a bit more complex - table layouts. They end the post with an interesting "hidden" feature inside the component, the Symfony track progress bar (animated gif included to show the end result).

tagged: symfony console component feature pretty output table track progressbar

Link: http://knpuniversity.com/blog/fun-with-symfonys-console

NETTUTS.com:
Using htaccess Files for Pretty URLS
Jul 31, 2009 @ 18:06:08

NETTTUS.com has a new tutorial that talks about "pretty URLs" and how you can make them happen on your site by combining a bit of htaccess/mod_rewrite magic with PHP.

While some claim pretty URLs help in search engine rankings, the debate here is fierce, we can all agree that pretty URLs make things easier for our users and adds a level of professionalism and polish to any web application.

To illustrate how it works, they create a simple URL shortening site, showing the difference between the two different methods (htaccess in Apache and PHP's URL handling) along the way. The application's pretty simple - store a URL in a MySQL database to be accessed via a special hash coming from the URL.

tagged: htaccess pretty url tutorial apache

Link:

Vinu Thomas' Blog:
Replace print_r and var_dump with Krumo
Apr 09, 2008 @ 19:44:31

Vinu Thomas has proposed a replacement for the usual var_dump or print_r sort of debugging developers tend to do - Krumo.

To put it simply, Krumo is a replacement for print_r() and var_dump(). By definition Krumo is a debugging tool (now for PHP5 only), which displays structured information about any PHP variable [...] it does the same job, but it presents the information beautified using CSS and DHTML.

It also supports output of other data in a "pretty format" like backtraces, included files and a listing of all constants. You can check out a demo of it in action here.

tagged: krumo printf vardump replace sourceforge css html pretty

Link:

SitePoint PHP Blog:
Pretty Blue Screen
Apr 05, 2006 @ 12:32:15

On the SitePoint blog today, Harry Fuecks shares some code he's worked up to create a "pretty exception" method for the Zend Framework.

Been playing around with Zend's framework some more and finally got annoyed enough about how exceptions are displayed to do something about it.

The code at the bottom of this post just needs including somewhere and enables a "pretty" exception handler—it's not specific to Zend's framework.

The idea is not original—it’s PHP port from webpy which used code from Django - imitation and flattery.

The post includes several images of the output, showing the standard screen and examples of an various options expanded in different situations. The code is provided for you to simply cut and paste into your editor of choice.

tagged: zend framework error handling pretty output zend framework error handling pretty output

Link:

SitePoint PHP Blog:
Pretty Blue Screen
Apr 05, 2006 @ 12:32:15

On the SitePoint blog today, Harry Fuecks shares some code he's worked up to create a "pretty exception" method for the Zend Framework.

Been playing around with Zend's framework some more and finally got annoyed enough about how exceptions are displayed to do something about it.

The code at the bottom of this post just needs including somewhere and enables a "pretty" exception handler—it's not specific to Zend's framework.

The idea is not original—it’s PHP port from webpy which used code from Django - imitation and flattery.

The post includes several images of the output, showing the standard screen and examples of an various options expanded in different situations. The code is provided for you to simply cut and paste into your editor of choice.

tagged: zend framework error handling pretty output zend framework error handling pretty output

Link:


Trending Topics: