Zend_Text_Figlet is a Zend component which enables developers to create a FIGlet text. A Figlet is nothing but a technique of creating large letters using ordinary text. I don’t know how to make a use of this in my daily matters, but its a nice recreation. A short history on Figlet can be found here. An example and the code to generate it is shown below.
____ __ _ ____ | _ \\ | || | || | _ \\ | |_| || | '--' || | |_| || | .__// | .--. || | .__// |_|--` |_|| |_|| |_|--` `-` `-` `-` `-`
<?php require_once("zend/text/figlet.php"); $figlet = new Zend_Text_Figlet(); echo $figlet->render('PHP'); ?> |
If you are displaying the output on a web page make sure to use the ‘pre’ tags around the Figlet. The Figlet looks good in a pure text format.
You can also define various options for the Figlet by passing the function an array of options, like say changing the font.
<?php require_once("zend/text/figlet.php"); /* use a different font */ $options = array('font' => 'graffiti.flf'); $figlet = new Zend_Text_Figlet($options); echo $figlet->render('PHP'); ?> |
__________ ___ ___ __________
\______ \ / | \ \______ \
| ___// ~ \ | ___/
| | \ Y / | |
|____| \___|_ / |____|
\/
You can download more fonts from here.
The default width of the Figlet output is set to 80 characters, which you can change with the ‘outputWidth’ option.
. . $options = array('outputWidth' => 120); |
For more options you can take a look at the documentation.
This site is a digital habitat of Sameer Borate, a freelance web developer working in PHP, MySQL and WordPress. I also provide web scraping services, website design and development and integration of various Open Source API's. Contact me at metapix[at]gmail.com for any new project requirements and price quotes.
2 Responses
1
Sameer’s Blog: Creating a Figlet text in php : Dragonfly Networks
November 19th, 2008 at 4:20 am
[...] has posted an example of a new(ish) component of the Zend Framework – the Zend_Figlet component – and how you can use it [...]
2
Ben Scholzen 'DASPRiD'
November 22nd, 2008 at 3:11 pm
Heh, at least one article about my Zend_Text_Figlet, nice one