Introducing IPS, a PHP interactive shell

It's been a while now since I first looked up for an interactive PHP shell. There quite a lot of projects in the wild, such as PHP_Shell, PHPInteractiveTerminal, iphp, phpsh, etc, but none that would actually satisfy me (either they didn't fulfill my requirements or they were only toy projects...

Replacing short tags with proper PHP tags 1

This is a little script I made to get rid of those damned short tags. [php] <?php while ($file = trim(fgets(STDIN))) { $content = file_get_contents($file); $search = array('/<\?=/', '/<\?(?!php|xml)/'); $replace = array('<?php echo ', '<?php '); if ($content != ($new_content =...

sfConsolePlugin, a console plugin for symfony 2

I've just release the first beta of my first symfony plugin: sfConsolePlugin. This plugins provides a PHP shell, with tab-completion, history support, and symfony capabilities. To install and use it, you need symfony 1.2 and the readline extension. From your project root: $ ./symfony plugin:install...

PHP's april's fool 8

http://wiki.php.net/rfc/namespacese... wait, we're not April 1st ?...

About the self keyword in static methods 2

While setting up a test server for some software I wrote at the office, I eventually noticed the following notice: Notice: Use of undefined constant self - assumed 'self' That surprised me, because 1) I though self were some kind of "superglobal" constant or a special token of the parser,...

How I use the Zend Framework 7

Having started a few applications using the Zend Framework, I came out with a few practices that I tend to use over and over. In this post I'll quickly expose some of them and explain why I do things the way I do them. As you'll notice, most of them are already widely known and used over the ZF...

PDO not throwing an exception when it should

Today I ran into an issue that I already ran into a few weeks ago when I did not have time to dig up, but today I had this time (this plus it's a really annoying issue as you'll see). The main symptom is that PDO does not throws exceptions when you'd expect it to. It's very annoying. The reason, in...

New home for pagination component documentation

For those caring, I just posted some quick documentation for the pagination component at my assembla space. More docs will follow (including extensive phpdoc docblocks I hope)....

Zend Framework 1.0.2 PEAR package is available 2

A PEAR package for the 1.0.2 version of the Zend Framework is now available from the PEAR PHPMafia channel. As usual, to install just issue the following: [bash] pear channel-discover pear.phpmafia.net pear install phpmafia/Zend...

Bugfixes release of Zend Framework pagination component 3

I just released on riskle's assembla space a new version of my pagination component for the Zend Framework which you can download right now: Riskle Paginate r122 This release fixes a nasty bug in Riskle_Db_Table::fetchCols which prevented from retrieving the right count of cols involved in the...

Zend Framework Pagination, third strike 7

UPDATE: new version (r105) available. The component was given a little rewrite as expected, but maybe a little bit later than I would have wanted to :-) So it now has its own Rowclass proxy from which you can pull various infos such as current page, page range, next page, etc all exposed as getter...

Riskle_Form, a quick wrapup 3

So well, I've been busy these days working on my own implementation of a form component in the ZF spirit. This post is to help me see where I'm at with this component, as well as planning future evolution. I'll try my best to describe what it does and does not, and what it could do in the future. Of...

Quick php5 pre-migration check

If you're wondering how much of a hassle it would be to migrate your app / codebase to php5, try the following command line (after having installed the php5-cli package of course): find . -name "*.php" -exec /usr/bin/php5 -l {} \; | grep -v 'No syntax errors' It'll show you all the files...

findBy{$Field} with Zend_Db_Table

A quick post to show how one can easily implement a findByField wrapper in Zend_Db_Table: [php] /** * Implements a simple findByField wrapper */ public function __call($method, $args) { if (preg_match('/^findBy([a-zA-Z0-9]+)$/', $method, $parts)) { $field =...

Stripping the logic: the Transfer Object 2

Sometimes you have to pass an object data to another object, or to another layer of your application (who said controller/view ?), while ensuring that the receiving entity will not be able to run business code encapsulated in your class. In the Zend Framework, several objects provide a toArray...

Zend Framework Pagination reloaded 8

UPDATE A new version of this component is available. I have a new version of my pagination component which solve the issue previously pointed out by Guy. This update comes along with a subclassed version of Zend_Db_Table which allows counting and specific columns selection respectively via the...

Searching the Zend Framework's manual: Google Co-op to the rescue 3

While the Zend Framework's manual is somewhat quite good, it lacks a feature that make it a really good manual: search. I find it very frustrating to not be able to make a simple search and therefor having to browse through the extensive TOC to find what I'm actually looking for. Here enters the...

Pagination with the Zend Framework 6

Yesterday I came up with a small pagination component for the Zend Frameworks. It implements the Proxy pattern around a Zend_Db_Table object, and overloads the fetchAll method. The main problem I encountered here was to retrieve the total number of rows for the table. I'm using a Zend_Db_Select...

A Zend controller plugin to enable RESTful behaviour 4

This is a simple controller plugin for the Zend Framework which enable RESTful behaviour. It basically adds the HTTP method name to the action name, so that the URL http://example.com/foo/bar will be dispatched to FooController::barGetAction on a GET, FooController::barPostAction on a POST, etc....

Get the current $view from a view helper

So you're making your own view helper and you need, for a reason, to access the running $view instance. Don't worry, all you have to do is implement a setView() method which will be called on your helper's instantiation, with the $view as argument: class My_View_Helper_SpecialPurpose { protected...

- page 1 of 3

Top tags