Archive

Archive for the ‘PHP’ Category

Scott’s Blog: Stupid Bug Reports

February 2nd, 2009

When you make a bug report or feature request to any sort of project please check you have all of the relevant information and if you can get someone else to check it through. Try searching Google first or ask in a mailing list.

For a performance issue check against an older version of PHP to see if you can work out when it was introduced, if you’re not currently testing the CVS version then check that as well. It may have been fixed already. Reports that language X is faster than PHP will also most likely be ignored, these really aren’t constructive and unless you can identify the issue within PHP it’s pointless to create a report.

Scott in his blog continues to write “Finally, don’t get aggressive or be an asshole when your bug reports get closed. PHP is an open source project and most contributors are volunteers. If you don’t like something then you are more than welcome to submit a patch.”

General Articles, PHP

Zend

January 1st, 2009

Introduction

Extending the art & spirit of PHP, Zend Framework is based on simplicity, object-oriented best practices, corporate friendly licensing, and a rigorously tested agile codebase. Zend Framework is focused on building more secure, reliable, and modern Web 2.0 applications & web services, and consuming widely available APIs from leading vendors like Google, Amazon, Yahoo!, Flickr, as well as API providers and cataloguers like StrikeIron and ProgrammableWeb. Expanding on these core themes, the Zend Framework is implemented to embody extreme simplicity & productivity, the latest Web 2.0 features, simple corporate-friendly licensing, and an agile well-tested code base that any enterprise can depend upon.

Extreme Simplicity & Productivity
Zend Framework is designed with simplicity in mind. To provide a lightweight, loosely-coupled component library simplified to provide 4/5s of the functionality everyone needs and that lets you customize the other 20% to meet your specific business needs. By focusing on the most commonly needed functionality, they have retained the spirit of PHP programming, managed to dramatically lower the learning curve, and the training costs – so developers get up-to-speed quickly. This has been achieved by:

* An extensible and well-tested code base – easy to augment
* A flexible architecture – not locked-in to a rigid application structure
* No configuration files necessary to get up and running – or when maintaining and deploying your apps

Frameworks and best practices mean reduced training costs and quicker time-to-market – important factors in adoption decisions. Built such a way that one can choose just the pieces they need to turbocharge any web application – all developers know where to find their PHP / Zend Framework code, speeding new development and reducing maintenance costs.

Latest Web Development Features
* AJAX support through JSON – meet the ease-of-use requirements your users have come to expect
* Search – a native PHP edition of the industry-standard Lucene search engine
* Syndication – the data formats & easy access to them your Web 2.0 applications need
* Web Services – Zend Framework aims to be the premier place to consume & publish web services
* High-quality, object-oriented PHP 5 class library – attention to best practices like design patterns, unit testing, & loose coupling

Friendly & Simple Licensing, Safe for the Enterprise
Based on the simple and safe new BSD license, with Zend Framework’s License, one can rest assured that their code is compliant, unimpeachable, and protected as you see fit. It is also require that all contributors to the open source Zend Framework to complete and sign a Contributor License Agreement (CLA) — which is based on the standard open-source Apache license — protecting your own intellectual property (that is, your added-value) built on Zend Framework.

Fully Tested – Extend Safely and Easily
Tested. Thoroughly. Enterprise-ready and built with agile methods, Zend Framework has been unit-tested from the start, with stringent code coverage requirements to ensure that all code contributed has not only been thoroughly unit-tested, but also remains stable and easy to extend, re-test with compatiable extensions, and to further maintain.

Downloads
Downloads are available from the official website. http://www.zend.com

Frame Works

ZooP

January 1st, 2009

Introduction

The Zoop Object Oriented Php Framework (The Zoop PHP Framework for short). A framework written in and for php.

The Zoop PHP Framework is stable, scalable and portable. It has been in production use for the last 5 years and has been used in many production environments. The Zoop PHP Framework is designed to be fast, efficient and clean. It is easily extendable and you choose to include only the functionality you use.

With Zoop an inexperienced coder can make secure web applications quickly. A more experienced coder will really appreciate how flexible The Zoop PHP Framework is. Both experienced and inexperienced coders alike will appreciate the automations that are at his/her disposal to handle mundane tasks.

The Zoop PHP Framework encourages separation of display, logic and data layers(MVC).

The Zoop PHP Framework is made up of many components and integrates many different projects including smarty (http://smarty.php.net) and the prototype AJAX framework. It also makes use of PEAR modules (http://pear.php.net). The efficient core components handle many of the functions you would have to code yourselves. Zoop’s integrated error handling can be configured to log errors for production environments, and is highly informative and readable which makes bugs easy to find and squash.

Zoop has been designed to make the developers life easier by providing tools to make efficient use of his/her time. On of our more unique and notable features is our implementation of GuiControls, a revolutionary idea in PHP that provides many form widgets with validation completely integrated, as well as a framework to develop your own guiControls extremely easily.

Zoop Features
The Zoop framework features GuiControls (a PHP implementation of .net’s webcontrols), AJAX support and integration, automatic form validation and creation (including db integration), a Smarty templating system, PDF creation, session handling, and SMTP template-based email sending, and integrated caching.

Downloads
The latest version of the Zoop framework is available at SourceForge.net.
There are three files at SourceForge:

* Zoop—The Zoop Framework.
* Skeleton—A Zoop skeleton application.
* Lib—Zoop’s PEAR library dependencies.

Go ahead and download all three.
Installing Zoop

Since Zoop is a PHP framework, you will need a working copy of PHP. If you don’t have this, downloads are available from PHP.net. Zoop works great with PHP 4.3.10 or greater. We like PHP 5.2. We also recommend using a PHP Accelerator like eAccelerator.

Begin by extracting the files. On Windows use 7-Zip or another program capable of extracting tar.gz files. Zoop can be installed anywhere on your system. Some people put it in /usr/lib/zoop others put it in ~/zoop . It doesn’t matter where you put it, just remember where it is because you need to tell your application.

The lib folder should be placed in the zoop folder, so you should have zoop/lib/pear/… Note that lib isn’t strictly necessary. Depending on your system’s PEAR installation, you may not need any of the included libraries. We provide them for ease of use, especially for shared hosting where you have no control over the system’s PEAR libraries.

Subversion

The latest Zoop code can also be checked out via subversion.
Zoop

svn co "https://secure.supernerd.com/svn/zoop/zoop/trunk" zoop

Skeleton

svn co "https://secure.supernerd.com/svn/zoop/zoop_skeleton/trunk" zoop_skeleton

Lib

svn co "https://secure.supernerd.com/svn/zoop/lib" zoop/lib

Frame Works

Yii

January 1st, 2009

Yii is a high-performance component-based PHP framework for developing large-scale Web applications. Yii enables maximum reusability in Web programming and can significantly accelerate the development process. The name Yii (pronounced as [i:]) stands for easy, efficient and extensible.

Yii is easy to learn and use. You only need to know PHP and object-oriented programming. You are not forced to learn a new configuration or templating language. Yii is extremely fast. Its overhead to applications written on top of it is negligible. As a matter of fact, it is one of the most efficient PHP frameworks around.

Yii is highly reusable and extensible. Yii is purely object-oriented. Everything in Yii is a self-contained component which can be configured, reused or extended easily. More importantly, Yii has an ever-increasing extension library consisting of user-contributed components, which may help reduce your development time significantly. Yii comes with a rich set of features. From MVC, DAO/ActiveRecord, to theming, internationalization and localization, Yii provides nearly every feature needed by today’s Web 2.0 application development. Yii has very detailed documentation. From the definitive guide to class reference, Yii has every information you need to quickly learn and master it.

Yii is carefully designed from the beginning to fit for serious Web application development. It is neither a byproduct of some project nor a conglomerate of third-party work. It is the result of the authors’ rich experience of Web application development and the investigation and reflection of the most popular Web programming frameworks and applications.

Last but not least, Yii is free! Yii uses the new BSD license, and it also ensures that the third-party work it integrates with use BSD-compatible licenses. This means it is both financially and lawfully free for you to use Yii to develop either open source or proprietary applications.

Credits
Yii incorporates many ideas and work from other well-known Web programming frameworks and applications. Below is a short list.
* Prado: This is the major source of ideas for Yii. Yii adopts its component-based and event-driven programming paradigm, database abstraction layers, modular application architecture, internationalization and localization, and many others.
* Ruby on Rails: Yii inherits its spirit of conventions over configurations. Yii also referenced its implementation of active record design pattern.
* jQuery: This is integrated in Yii as the foundational JavaScript framework.
* Symfony: Yii referenced its filter design and plug-in architecture.
* Joomla: Yii referenced its modular design and message translation scheme.

License
Yii is released under the BSD License. This means you can use it for free to develop either open source or proprietary Web applications.

Downloads
Downloads are available from the official download page. http://www.yiiframework.com/download/

Frame Works

gzip nusoap requests

December 17th, 2008

Recently for a project involving travelport xml api integration, we badly needed the soap requests to be gzipped, since the technical support people suggested. Also we were aware of the benefits of using gzEncoded data when transmitting through the Internet. For the same we checked the wid internet searching with all sort of combinations of gzip nusoap request. Speaking from the inner view, we already had developed a handful of classes to abstract the SubmitXML api provided by Galelio Travelport. And frankly were reluctant to trash all the code already written.
At this point, we swam through the whole code of nusoap.php; should say thanks to easyeclipse, and made some minor tweaks here and there. The following was all that was required, though I doubt if this would be a generic solution, this definitely serves our purpose and the versions we used are 0.7.3/Revision: 1.114.

in class soap_transport_http added property gzipRequests (line 2148)
var $gzipRequests = true; // gzip any requests..

in function buildPayload at the top (line 2799)
if($this->gzipRequests){
$data = gzencode($data);
$this->setHeader("Content-Encoding",'gzip');
}

in function sendRequest (about line 2874), just in case the request is using curl
if($this->gzipRequests){
$data = gzencode($data);
}

PHP, Tips

PHP; Towards a 5.3 release

July 8th, 2008

Straight from the php internals discussion:

Items on the list as the key features of this release

1) namespaces
Here we need to make sure that the current state is now in a coherent state. I think Derick still has some issues with the recent change by Greg, but even his criticism did not sound all to loud. So I think we are in a good state here?

2) late static binding
Etienne had some questions recently, which were met by criticism by Stas. However all others agreed with the change. So I guess we are solid here too?

3) re2c
Rui recently came to the list with notes on the ZE MB feature.

4) windows support
Ever since Edin disappeared it has become clear that we have a bus factor issue with windows support. The windows team is working to rectify this situation. We need to make sure that the infrastructure to deliver windows binaries for PHP 5.3 as well as PECL extension is in place before we can release 5.3.

5) BC issues
Well this is a bit of an “anti-feature” in the sense its not a task anyone is dedicated to. The point is that we need to make sure that we understand any BC issues we currently have, so that we can either correct them or document them.

These are the 5 areas we the RMs would hope that people focus on.

Thats actually 3 focus areas too many for my taste, but goes to show that we might want to release more often (given that the list for 5.4 is already cramming up).

On top of this we also have a few other changes that are of quite some importance, but that to me will not stop a release if they do not make it (for the extensions we feel that they will be available via PECL for those who really need them now in the worst case). But these are big features non the less that could warrant a new minor release on their own alone if it would be for even bigger stuff:

1) intl extension
Last discussion ended without a decision on the class naming. I specifically remember Derick taking issue with intl ext “invading” the date ext namespace. Stas however arguing that the intl ext is supposed to bring some forwards compatibility to PHP 6 and therefore naturally will need to span the namespaces of other extensions, that are planned to be expanded for PHP 6.

2) phar extension
I guess we are pretty solid here?

3) E_DEPRECATED
Here we just need to make sure that we actually mark only the things as deprecated that we actually want to deprecate. This ties in a bit with the BC issues point above.

4) __callStatic

5) Garbage Collection

So is anything missing? Please everybody take time to review the todo list, make sure that all items are on the list, make sure that the information is as up to date as possible. Finally anyone who’s name is on this list (or who will add himself) should get in contact with Johannes and myself within 1 week (thats July 9th) to explain the state of the todo item and when he can finish the item and what the general impact the feature has on the release. Also please bring up any issues, especially for the above 6 points, to the list and try to focus on solving the issues in a timely manner. We RMs will try to moderate as much as possible, but understand that at some point we will have to have to go with one approach (or in the worst case we might have to push a feature to 5.4).

After July 9th, we will then publish a tentative release plan within 3 days afterwards. The tentative schedule will probably try to move us quickly towards a feature freeze together with a first alpha. Depending on our discoveries we will schedule beta and RC releases (obviously subject to continued review).

General Articles, PHP

protoype.js: Deep Category Select; Ajax

April 7th, 2008

I was experimenting with the prototype.js library, thanks to all who have contributed towards this, and the wonderful documentations avaliable as download, as well as online references.

For a multilevel hierarchical selector of category, where the top levels should not be selectable, the existing ui elements were not enough to show off, with out incurring ambiguity. This led me to do the basic tests, and finalized the said widget. It does not support much now, though I may be working on a extension which will support multi-select.

See the Deep Category Select, in action where it is embedded into an example.

Category Selector by jiju-saturn

Javascript, PHP

PHP 5.3 upto 30% performance boost

March 27th, 2008

As Johannes Schluter mentions, the results of some benchmarking have been posted concerning the performance of PHP 5.3 versus the current 5.2 series:

Dmitry posted results of performance test comparing PHP 5.2 and 5.3 to internals which are impressive numbers.

The improvements were measured based on several popular pieces of software like Drupal, typo3 and WordPress. The overall performance gian was around thirty percent across the board.

PHP

Building File Uploaders :: Object Method

March 25th, 2008

On DevShed there’s a new tutorial showing how to build file upload functionality into your scripts.

If you’re a PHP developer who has built a certain number of web applications, then it’s quite probable that you’ve already worked with HTTP file uploads. [...] First I’m going to teach you how to handle file uploads using a procedural approach, and then, with the topic well underway, by way of the object-oriented paradigm.

The introduce the beginners out there to the $_FILES array (a superglobal) that contains the details about the file(s) that have been submitted. Next comes the construction of a simple form and how to handle the submission on the PHP side.

PHP, Tips

Back to PHP after 2 years on Rails

December 6th, 2007

In this post Sivers writes I spent two years trying to make Rails do something it wasn’t meant to do, then realized my old abandoned language (PHP, in my case) would do just fine if approached with my new Rails-gained wisdom.

“Is there anything Rails can do, that PHP CAN’T do?”

The answer is no.

I threw away 2 years of Rails code, and opened a new empty Subversion respository.

Then in a mere TWO MONTHS, by myself, not even telling anyone I was doing this, using nothing but vi, and no frameworks, I rewrote CD Baby from scratch in PHP. Done! Launched! And it works amazingly well.

It’s the most beautiful PHP I’ve ever written, all wonderfully MVC and DRY, and and I owe it all to Rails.

Read the original post by Derek Sivers

PHP