 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Benjamin Eberlei: Doctrine and SOLID
by Chris Cornutt February 05, 2013 @ 11:09:33
Benjamin Eberlei has a new post to his site today answering a question he sometimes gets about using Doctrine2 in a SOLID context (more on SOLID development here) as it seems difficult to follow the Single Responsibility Principle with how the tool is used.
These problems are related to the inability to share behavioral code through aggregation and the complexity of state transformations. Combining both, your average entity with 5-15 fields can end up with hundrets or thousands lines of code. The solutions to both problems boil down to minimizing duplication and maximizing clarity.
He looks at two different kinds of objects Doctrine uses in its setup, the value objects and method objects, and "maximize clarity" on them by dividing them up into more functional-related objects, passed into each other via method injection.
voice your opinion now!
doctrine value method objects clarity solid development principles
Michael Nitschinger: Caching Doctrine Entities with Couchbase
by Chris Cornutt January 08, 2013 @ 10:19:07
Michael Nitschinger has a new post to his site today showing how you can cache the entities you've created with Doctrine using Couchbase as a simple caching tool.
As part of our ongoing efforts to make Couchbase more integrated with frameworks and libraries, we added caching support for the Doctrine ORM. [...] Caching can either be used standalone (through the API provided by doctrine/common) or integrated with the ORM functionality. We'll look at both variants through simple examples, a good documentation can also be found here. Note that at the time of writing, the CouchbaseCache is not mentioned as a caching driver because the documentation still needs to be updated.
He walks you through the steps to get everything you need installed, both through Composer and the Couchbase extension so your PHP installation will support it. He includes sample code that sets up the cache and shows how to check it to see if a key exists. With this base in place, he expands it out to working with the Doctrine ORM. He shows how to create a sample "Person" entity, inject it into the entity manager and perform a query with the Result Cache to locate the object.
voice your opinion now!
doctrine entity cache orm couchbase tutorial
PHPMaster.com: Sending Email with Swift Mailer
by Chris Cornutt December 04, 2012 @ 11:34:54
On PHPMaster.com today there's a new tutorial showing you how to use Swift Mailer, a popular (and well-established) mailing tool.
Sending emails programmatically is a common task that programmers must deal with often. Although you can use PHP's native functions, they can be too low-level, especially when you want to attach one or more files to your message. If you don't want to use the native functions, or if you want to send mail using an object-oriented approach, then this is the article for you. I'll introduce you to Swift Mailer, a powerful component-based library that let's you send emails easily. Started in 2005, Swift Mailer is a library that provides several classes that allow you to send emails from within your PHP scripts or web applications.
Included in the post are a basic example of sending a plain-text email, working with attachments and including a template into the body of the message (with spots to fill text in).
voice your opinion now!
swiftmailer introduction tutorial email pear
Jake Bell: PHP Annotations Are a Horrible Idea
by Chris Cornutt October 18, 2012 @ 09:45:56
In his latest post Jake Bell talks about why he thinks annotations in PHP are a bad idea (not the concept of them, but how developers are currently using them. He's in favor of officil support though).
Both the Symfony 2 and Doctrine 2 libraries and components make liberal use of what have come to be called annotations - special code comments, usually prefixed with an @ that are actually interpreted by the application and affect its functionality. [...] This trend needs to die.
He points out that the use of code comments like this isn't a good practice and applications should never have to rely on them for functionality. He mentions issues with syntax/language functionality (can't use "php -l" on them, can't var_dump an annotation) and that it makes it more difficult to read and interpret the code. He includes an example from Ruby of an alternative and a possible solution in PHP involving a static "mapping" variable.
voice your opinion now!
annotations code comments opinion doctrine symfony
Till Klampaeckel: Continuous Integration Automated database setup with Doctrine on Travis-CI
by Chris Cornutt August 14, 2012 @ 10:55:57
Till Klampaeckel has a new post to his site showing how you can use the external continuous integration system Travis-CI to handle automated database testing for your PHP app using Doctrine.
Testing is important - most people understand that by now. A lot of people write tests for their open source code already, but in-house testing is still hard. [...] While I prefer to run my database tests against a SQLite in memory database, there are these edge cases, where I work with multiple database or I write a direct query (and by-pass the ORM-magic). In these cases I need to have that database server available in my test environment! The following blog posts explains how to solve these things with Travis-CI. I will walk you through the setup on Travis-CI's business service. But most of this applies to their open source offering as well.
He's broken it up into a few different steps - the setup and configuration of the ".travis.yml" file, adding in a "composer.json" file with the needed dependencies and the recommendation of a "phpunit.xml" in your project's root. He shows how to use Doctrine's "SchemaTool" utility to generate his schema off of the comments on his entities (instead of checking in SQL). This setup them gives him access to Doctrine's EntityManager object in his tests and he can go from there. If you're thinking about doing something similar, check Travis' list of supported databases before you do anything, just to be sure.
voice your opinion now!
database testing autmation travisci continuous integration tutorial doctrine
Lorna Mitchell: Installing PEAR Packages Offline
by Chris Cornutt July 30, 2012 @ 12:09:41
Since you can't always be online when you need to install new libraries you'll need for your PHP work, Lorna Mitchell has posted a quick guide to downloading and installing PEAR packages when you're offline.
As with most tools that work really well, I know very little about PEAR. I mean, I use it all the time, and I love it for getting all the extensions installed that I need for the work I do. [...] However I'm now in a situation where I might need to install PEAR packages with a connection that may or may not be working, and I'm not sure exactly which packages I might need, so I wanted to know whether I could use PEAR as my packaging tool even when I wasn't able to reach the usual channels. And guess what? I can!
The install is a pretty simple two-step process - just download the package(s) you'll need for your development and point the PEAR installer (you'll need this installed first, obviously) at the archive file. It's smart enough to take care of the rest.
voice your opinion now!
pear package install offline installer tutorial
Matthew Weier O'Phinney's Blog: On Visibility in OOP
by Chris Cornutt June 29, 2012 @ 09:52:03
Matthew Weier O'Phinney has a new post to his blog today looking at visibility in OOP in PHP - less about the features the language offers and more about the theory of their use.
I'm a big proponent of object oriented programming. OOP done right helps ease code maintenance and enables code re-use. Starting in PHP, OOP enthusiasts got a whole bunch of new tools, and new tools keep coming into the language for us with each minor release. One feature that has had a huge impact on frameworks and libraries has been available since the earliest PHP 5 versions: visibility.
He covers a bit of the syntax and features of public, private and protected and mentions a keyword not often seen in PHP applications - final. The reason all of this came up was work on annotation support in Zend Framework 2 and some difficulty in integrating it with Doctrine support. The "final" status of the class was part of the problem, and after a a lot of copy & pasting he decided on a different tactic - using its public API to try to work around the problem.
In sum: because the class in question was marked final and had private members, I found myself forced to think critically about what I wanted to accomplish, and then thoroughly understand the public API to see how I might accomplish that task without the ability to extend.
voice your opinion now!
visibility oop final annotation doctrine
Stuart Herbert's Blog: Getting PEAR Working On Windows 7
by Chris Cornutt May 10, 2012 @ 10:43:49
Stuart Herbert has a new post today showing how to get the well-established PEAR package management system working on Windows 7 so you can easily call "pear install" on whatever your needs might be.
So that I don't forget how to do this next time around. Worked for me, your mileage may vary. First step is to get a working install of PHP. [...] At this point, you should be able to open up a Command Prompt, and type 'php -v', and see the response 'PHP v5.4.latest …' appear as expected. Now for PEAR itself.
He gives step-by-step instructions on how to get PEAR up and running - downloading and configuring it with the correct Windows-based paths and using the PEAR_ENV.reg file to update your registry.
voice your opinion now!
pear windows7 install tutorial registry
GotoTech.com: Developer Diary Taming Doctrine's 2000 Flushes
by Chris Cornutt May 02, 2012 @ 10:19:35
In this new post to the GotoTech.com blog Eric Burns talks about a way he's "tamed Doctrine's 2000 flushes" with a wrapper around the EntityManager to make controlling the database flushes simpler.
For my project I decided to use the Doctrine 2 ORM to manage my data layer. We also use this at work, so the biggest reason I chose this was to be able to learn more about Doctrine to help me in my job. But this decision also makes sense for my project because my entity relationships will likely be fairly straightforward for the most part and using an ORM will allow me to make a lot of progress very quickly without (I hope) causing me lots of trouble later on.
His handy wrapper (Data Manager) makes it simpler to perform the flush and still take transactions into consideration. His simple class includes "flush", "commit" and "startTransaction" methods that don't actually perform the flush until the commit is called.
voice your opinion now!
doctrine flush database wrapper transaction
Liip Blog: Table Inheritance with Doctrine
by Chris Cornutt March 28, 2012 @ 09:30:09
On the Liip blog there's a recent post looking at table inheritance with Doctrine, the popular PHP ORM tool. In the post, Daniel Barsotti talks about a database model that needed some updating due to their searching needs.
Our first idea, and it was not that bad, Drupal does just the same, was to have a database table with the common fields, a field containing the type of item (it's either an event or a blog post) and a data field where we serialized the corresponding PHP object. This approach was ok until we had to filter or search LabLog items based on fields that were contained in the serialized data.
To resolve the issue they turned to multiple table inheritance, relating the LabLogItem to both a BlogPost and Event. They also show how it could be modeled with a single table, but opt for the multiple method. Included in the post is the Doctrine-based code showing how to create the parent entity for the LabLogItem and the two child entities for the blog post and event. There's also a brief snippet showing how to use them with the EntityManager.
voice your opinion now!
table inheritance doctrine orm tutorial multiple
DZone.com: PHP objects in MongoDB with Doctrine
by Chris Cornutt March 21, 2012 @ 10:03:59
On DZone.com today Giorgio Sironi has a new post showing how you can use Doctrine with MongoDB to work with Document objects from the database.
In the PHP world, probably the Doctrine ODM for MongoDB is the most successful. This followes to the opularity of Mongo, which is a transitional product between SQL and NoSQL, still based on some relational concepts like queries. [...] The case for an ODM over a plain Mongo connection object is easy to make: you will still be able to use objects with proper encapsulation (like private fields and associations) and behavior (many methods) instead of extracting just a JSON package from your database.
He briefly mentions that the PECL extension for Mongo needs to be installed prior to trying out any of the examples. His first example shows how to create a DocumentManager (similar to the normal EntityManager for those familiar with Doctrine). He also shows an integration with the ORM and shares some of the findings he's made when it comes to versioning the resources (hint: annotations are your friend).
voice your opinion now!
mongodb doctrine object orm tutorial versioning
Phil Sturgeon's Blog: Packages The Way Forward for PHP
by Chris Cornutt March 07, 2012 @ 08:29:57
In this new post to his blog Phil Sturgeon talks about what he (and apparently several others) think is the "way forward for PHP" to make it a better language and ecosystem - packages.
What is a package? A package is a piece of reusable code that can be dropped into any application and be used without any tinkering to add functionality to that code. [...] Most package systems also allow for something called dependencies. [...] This is how most modern programming languages work, but to make a generalisation: PHP developers hate packages. Why? Well while other languages have great systems like CPAN for Perl, Gems for Ruby, PIP, PHP has had a terrible history with package management going back years.
He talks about one of the main current packaging systems, PEAR, and how, despite its attempts, it just hasn't seen the adoption the package management of other languages has. Phil makes a recommendation that is slowly becoming more and more popular in the PHP community - building "unframeworks". These sets of reusable components (similar to the ideas behind Aura, Symfony and Zend Framework 2) are designed to be dropped in and used without the dependencies of the frameworks they live in. He points to the Composer/Packagist dynamic duo as a way through all of the current packaging issues - a simple way to make any project an installable package just by adding a configuration file.
voice your opinion now!
packages composer packagist pear community support unframework
Jeremy Cook's Blog: Making PHPUnit, Doctrine & MySQL Play Nicely
by Chris Cornutt March 02, 2012 @ 12:05:48
Jeremy Cook has put together a new post showing how he got PUPUnit, Doctrine and MySQL to "play nicely" together when he was writing up some of his tests in a current application.
One of the pain points for me though has been in getting Doctrine setup with PHPUnit for testing. One of the main Doctrine contributors, Benjamin Beberlei, has written a package called DoctrineExtensions which amongst other things adds a class called DoctrineExtensionsPHPUnitOrmTestCase which extends PHPUnit's DbUnit database test case class. This all works well in principle but hits a major snag in reality: MySQL doesn't allow InnoDb tables with foreign keys to be truncated. PHUnit's database extension truncates the database tables before each test run and inserts a fresh set of data to work with.
To work around this issue Jeremy by porting over a method posted by Mike Lively over to Doctrine as a custom "MySQLTruncate" class (code included in the post). He also includes some sample code showing it in use - a basic ORM test case that calls the truncate method when its set up.
voice your opinion now!
phpunit doctrine orm unittest mysql truncate
Sameer Borate's Blog: Building a adjacency matrix of a graph
by Chris Cornutt February 17, 2012 @ 09:19:12
Building on the graphing tutorial in his last post Sameer continues on looking at graphs in PHP with this new post showing how to create an "agency matrix" of a currently built graph.
Building a graph is not enough; we also need the ability to search through it. To make it easier to build search algorithms, it is useful if we can represent the graph and its connections in a different way; adjacency matrix being one such representation. An adjacency matrix is a means of representing which vertices (or nodes) of a graph are adjacent to which other vertices.
He includes some sample code to extract the data from a graph (built with the PEAR Structures_Graph package) and create a basic "table" of information about each nodes' connections.
voice your opinion now!
agency matrix tutorial graph structuregraph pear
Sameer Borate's Blog: Building a Graph data structure in PHP
by Chris Cornutt February 15, 2012 @ 09:35:15
In the latest post to his blog Sameer Borate takes a look at using the Structures_Graph package from PEAR to create data structures in PHP with linked nodes for directed and undirected graphs.
The Pear Structures_Graph package allows creating and manipulating graph data structures. It allows building of either directed or undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing as well as for characteristic extraction from the graph topology.
After sharing the one-line install, he shows how to create some instances of the package's Nodes and how to connect them to a graph and link them to other nodes. He includes a few examples - a simpler one with multiple nodes joined in a directed graph, another showing how to associate data with a node and how to query the graph for node connections and testing to see if the graph is acyclic.
voice your opinion now!
graph node structure structuregraph pear package tutorial
Marcelo Gornstein's Blog: Writing PHP applications with Doctrine2 as ORM and Ding as DI container
by Chris Cornutt January 31, 2012 @ 08:59:18
In a recent post Marcelo Gornstein takes a look at using dependency injection with Doctrine2 using his Ding container.
This article will show how we can develop software in php with a nifty design and architecture, and very much like other languages like java, using an ORM and an AOP, DI, Events container. I will assume you've read (or at least took a quick look) at this article that explains the tree layout used throughout the code, and that you have some basic knowledge of Doctrine2 and used it before on your own.
He starts with the result - an easy to use, self-contained (and decoupled) system for accessing the Doctrine2 instance. It's event-driven and uses Aspect-oriented programming to mange interactions between components (or as he calls them "beans"). Code is included for the entire process for a logger, the User entity, entity manager, user repository and transactional aspect. You can find the complete source for his example on his github account.
voice your opinion now!
dependency injection di tutorial doctrine ding orm aspectoriented
Mike Wallner's Blog: Dropping server load with HTTP caching
by Chris Cornutt January 27, 2012 @ 09:43:04
Mike Wallner has shared a quick and easy HTTP caching technique in a new post to his blog today. The key is in using the PEAR HTTP_Header package.
Ever watched youself browsing e.g. a web forum? Noticed that you viewed the same page several times? Well, this means extraordinary and useless load for your server if there's no caching mechanism implemented in the web application. Even if there is some file or db cache you can still improve performance with implementing some http cache.
With a few simple lines of code using HTTP_Header, you can tell your scripts how long to set the "expires" header to on your requests. This increment (in seconds) is relayed to the browser to tell it when to next fetch the page and not reload from cache.
voice your opinion now!
http cache pear package httpheader tutorial
Mike Purcell's Blog: Use PHPUnit without PEAR
by Chris Cornutt January 26, 2012 @ 09:48:00
Mike Purcell has a new post to his blog showing a method he's followed to be able to use the popular PHPUnit unit testing software without having to go through the PEAR installer to get there.
PHPUnit is a great tool to protect us developers from introducing new defects when adding new features or re-factoring code. However there is one HUGE downside to PHPUnit; it must be installed using PEAR. Personally, I don't like 'auto-installers', I'd prefer to know what exactly is happening behind the scenes with regards to which libraries are required and how they are being called. [...] After breaking down the PHPUnit source code, I realized it could be installed without going through PEAR, and without too much headache.
He walks you through the directories you'll need to set up (test/vendor), the commands you'll need to get the latest version and unpack it, changes to set up some symlinks and updating the PHPUnit source to modify the autoloader, bootstrap and phpunit executable.
voice your opinion now!
pear phpunit without installer autoinstall package management
PEAR Blog: What would you do with 5 million lines of code?
by Chris Cornutt January 24, 2012 @ 12:18:07
On the PEAR blog today there's an update about the migration over to github that 5 million lines of code has already made:
Since October 2011, 5 million lines of the PEAR codebase has shifted to github. Hand in hand with this shift has been the tireless work of Daniel C - someone who brazenly said "I will fix the failing packages!" in the tail end of last year.
As a result of his efforts a list has been created of known good packages to use with PHP 5.4. Other results include:
- All test infrastructure upgrading to PHP 5.4 release candidates
- All database driven test suites executing properly, catching a variety of simple bugs
- Hitting a point of "near zero" patches to be applied to unmaintained packages
- Increasingly, the PEAR QA team is delivering PHP 5.3+ friendly forks of existing packages
voice your opinion now!
pear migrate github package library update
php|architect: Geolocation Easier Than It Looks
by Chris Cornutt November 08, 2011 @ 08:03:21
On the php|architect site Jeremy Kendall has a new article looking at geolocation in PHP and how, despite some comments in the past about its difficulty, some more recent tools make it relatively simple.
Have you ever wanted to add location-aware content to your web applications? Would you believe me if I told you it was dead easy, and you could be up and running in about 10 minutes? The first thing you want to do is use someone else's work. Geolocation is a solved problem; there's no need to roll your own. I went searching for free Geolocation APIs and found two I wanted to try: MaxMind's GeoLite API and Quova.
He briefly introduces each data source - GeoLite as a downloadable database and Quova as an API. Sample code is included for using the data from both of these services to find a location based on an IP address. He does include one caveat though - be careful about accuracy, they usually only promise things to be within 25 miles of the spot you're actually looking for.
voice your opinion now!
gelocation ip geolite quova tutorial pear package
Community News: EngineYard Hosts "Future of PHP" Live Panel - "PEAR & Pyrus"
by Chris Cornutt November 07, 2011 @ 13:09:35
EngineYard, a company that recently merged with the PHP platform as a service provider Orchestra.io, has a new live panel podcast about the Future of PHP, specifically involving PEAR and Pyrus.
If you are a PHP developer using PEAR and Pyrus, we invite you to join us this week as we explore the future of PEAR and Pyrus. We'll be discussing issues such as where PEAR/Pyrus will be going in the next few years, what obstacles may be on the horizon, and how they're going to get where they're going.
The live panel, hosted by Elizabeth Naramore, will include experts from the two projects: David Coallier (President), Helgi Þormar Þorbjörnsson, Brett Bieber, and Till Klampäckel. There's still time to sign up to attend - the show happens on November 17th. To put your name in to be a part of the event, fill in the info here and you'll be sent more information about attending.
voice your opinion now!
podcast live panel pear pyrus futureofphp engineyard
PEAR Blog: PEAR Development on Github
by Chris Cornutt November 07, 2011 @ 12:36:57
On the PEAR blog today it's been pointed out that many PEAR packages are moving to github as their standard place for development and repositories under the pear and pear2 accounts are available for anyone wanting to make the move.
While the existing PEAR packages will continue to use the pear.php.net distribution and bug tracking capabilities; it's never been easier to contribute to a PEAR package - simply fork; add your changes and send us a pull request. If your preferred packages aren't yet on github, please feel free to drop us a line on the pear-dev mailing list.
Here's more about the process to get the repository set up and how to migrate your package's current code from SVN over to github. The transition's pretty painless and can make the social development and improvement of your package a lot simpler.
voice your opinion now!
pear development github svn migrate pear2 development
PHPBuilder.com: An Early Look at Zend Framework 2.0
by Chris Cornutt November 01, 2011 @ 11:40:52
On PHPBuilder.com Jason Gilmore has posted a first peek at Zend Framework 2, an upcoming reworking of the popular framework with PHP 5.3-centric features.
Version 2.0 seeks to improve upon the current release in a number of ways, focusing on making it easier to get started using the framework, improving performance, and fully embracing the latest PHP language enhancements made available to version 5.3. [...] Although the official release won't be out for several more months, it never hurts to take an early look at what the future holds for a technology used by countless PHP developers around the globe. In this article I'll present a meandering introduction to the key version 2.0 features that I find particularly compelling.
He starts with a brief tutorial on getting the latest version of ZF2 from the git repository and creating basic project. The changes in the framework have fallen into a "rewrite only where it makes sense" mentality and changes have really only been made transparently to the backend or as new features/components like module management and Doctrine 2 integration. He also points out a few resources you can use to keep up to date on the latest from the framework including the changelog, mailing list and the ZF2 blog.
voice your opinion now!
zf2 zendframework2 early look introduction project module doctrine
PHPBuilder.com: Incorporate Weather Data into Your PHP Web Apps
by Chris Cornutt September 28, 2011 @ 13:44:29
On PHPBuilder.com today there's a new tutorial helping you integrate weather data into your site with the help of the Services_Weather PEAR package.
Regardless of whether you consider the weather to be an obsession or nuisance, there are plenty of opportunities to incorporate weather-related data into your Web application. The Services_Weather PEAR Package offers what is perhaps the easiest way to begin retrieving weather-related data.
Included in the post are the commands you'll need to get the package installed (via the PEAR installer) and sample code to set up the connection - in this case to Weather.com - to fetch the results for a search location. The "search" method will return the best guesses for your input and give you the unique code to use for fetching other values, like the current forecast.
voice your opinion now!
weather data tutorial pear package servicesweather
Bertrand Mansion's Blog: Twitter Bootstrap and the QuickForm2 Callback Renderer
by Chris Cornutt September 26, 2011 @ 12:23:41
In a new post Bertrand Mansion shows how he combined the versatility of the PEAR QuickForm2 package and the Bootstrap project from Twitter to quickly make a form using the project's styling (CSS).
I don't know about you, but for me building HTML Forms and styling HTML Forms are maybe the most boring things in web development. It's repetitive and takes a lot of time to do things correctly. That's why tools like Twitter's Bootstrap and PEAR's HTML_QuickForm2 can help with this part of our job. Wouldn't it be nice to have QuickForm2 generate a markup compatible with Bootstrap CSS, so that you could get a nice looking form without to much efforts? Well, that's what I plan to do here.
He starts by creating a simple QuickForm2 form with no renderers attached (no pre-defined styles) and a custom render callback that wraps the items in "div" tags with the correct styles. There's also a custom renderer included for grouping items with additional styling attached.
voice your opinion now!
twitter bootstrap pear quickform2 callback style render css
Stuart Herbert's Blog: PHP Components Shipping Web Pages With Your Components
by Chris Cornutt August 16, 2011 @ 13:13:06
Stuart Herbert's latest post in his "PHP Components" series looks at an optional but handy thing you can include in your component's package - web pages (be they a manual or other kind of information). This new post talks about where they should lie in the component's package structure.
I'm now going under the bonnet of our components, and looking at the different file roles that the PEAR installer expects to find when we distribute our component as a PEAR-compatible package. It isn't very often that a component needs to ship web pages too, but should the need arise, here's how to do it.
He starts by defining what a "web page" could be (HTML, Javascript, CSS, etc) and gives the place in the hierarchy they should fit. When you use the PEAR client to install the package, these files are placed in the "www" folder of your PEAR installation.
voice your opinion now!
component webpage structure tutorial pear
Leaseweb Labs Blog: Tuning Zend framework and Doctrine
by Chris Cornutt July 26, 2011 @ 12:35:03
On the Leaseweb Labs blog there's a recent post looking and some of the things you can do to optimize Zend Framework and Doctrine when used together for database access.
In principle, the combination of Zend Framework with Doctrine is not too difficult. But first let's talk about the preparations. According to the author of Zend Framework, the default file structure of project can be a bit more optimal.
They start by describing this optimized file structure (moving the models out of the modules and into the library) and what you'll need to change in Doctrine's configuration to make this work. The post also includes examples of what the larger config should look like when the changes are made. They show how to extend the default Doctrine CLI tool to make a custom "sandbox" instance and show some tuning you can do on the Zend Framework side so it can optimally work with the new models.
voice your opinion now!
tuning zendframework doctrine tutorial model structure
Jigal Sanders' Blog: A first look at Doctrine 2.1
by Chris Cornutt July 22, 2011 @ 10:33:08
In a new post to his blog Jigal Sanders shares some of his experience in working with Doctrine 2.1 in a Zend Framework-based (1.11.9) application for his database interface needs.
I hadn't been using Doctrine for a while and decided to pick it up two weeks ago, as we wanted to see if we can implement it for our CMS at our office. So I setup a clean installation of the zend framework (1.11.9) and tried tried to implement Doctrine. The main goal was to see if we can reverse engineer existing databases and then start doing some queries.
There were three things he found in the process that caused a few issues:
- A confusing set of terms and features that weren't explained well enough to know their use
- Getting things like autoloaders working with the Zend Framework to make things work well together
- A potential bug with the "name" property on an object and some automatic namespacing Doctrine tries to do
There are already a lot of resources available on the Internet. I have looked at various configurations, like for example the 'bisna' project from Guilhere Blanco. But I keep saying that it's really difficult and has a steep learning curve. Doctrine 1.2 was really simple. Doctrine 2.x is a lot more difficult to get into.
voice your opinion now!
doctrine zendframework problems orm experience
Tom Jowitt's Blog: Streamlined PHP Development - Part I
by Chris Cornutt July 18, 2011 @ 12:54:19
As the first part of a series, Tom Jowitt has posted this introduction to setting up a brand new development environment with some of the basic tools any PHP developer should need.
I dunno about anyone else but my development environment is usually in some form of barely-controlled chaos. It's one command away from collapse with folders full of test software, symlinks that lead to long-forgotten libraries and ancient VCS repos that only a mother could love, all held together with sticky-tape shell scripts. [...] This series of posts will look at the tools available to PHP developers who want to be liberated from the mundane and the frustrating tasks that plague our lives.
He doesn't describe the installation of the basic platform - Apache, PHP and MySQL on Ubuntu - but jumps right into the details of the settings. He shows how to:
- configure the VirtualHosts in Apache,
- installing and updating PEAR,
- Install/configure XDebug,
- Set up PHPUnit,
- and install git for version control
In the next post he'll show how to set up Phing for building/testing out the code.
voice your opinion now!
development tutorial install configure environment xdebug phpunit git pear
PEAR Blog: PEAR in July 2011
by Chris Cornutt July 11, 2011 @ 08:51:28
On the PEAR blog there's a new post talking about some of the things coming up in July that you might want to take note of.
There's nothing quite like having your blogging system go MIA for a while to give your community an overwhelming impression that no one is home. Thankfully; despite the radio silence between updates there's quite a lot to talk about!
The updates include mentions of several new PEPr proposals for packages related to Mercurial support, Twitter and holiday date validation. There's also a mention of the large amount of PEAR channels that are popping up and the future of PEAR in PHP 5.3+ with Pyrus.
voice your opinion now!
pear update channel pepr proposal community htmlquickform2
DZone.com: The era of Object-Document Mapping
by Chris Cornutt July 08, 2011 @ 11:45:46
On the PHP on Windows section of DZone.com today Giorgio Sironi has posted about a different sort of object mapping than is usually thought of with databases - object-document mapping.
The Data Mapper pattern is a mechanism for persistence where the application model and the data source have no dependencies between each other. [...] But everytime we talk about the Data Mapper pattern, we assume there is a relational database on the other side of the persistence boundary. We always save objects; we always map them to MySQL or Postgres tables; but it's not mandatory.
He talks about two projects, MongoDb_ODM and CouchDb_ODM, that the Doctrine project is working on to help make working with document-driven databases as simple as the usual ORMs. He includes a brief code snippet showing how the feature will work (hint: a namespace of Document instead of Entity). He lists some of the features - including the usual ORM capabilities, support for collections, cascade of persistence - and where you can get the latest code for it (from github and PEAR
voice your opinion now!
object document mapping doctrine mongodb couchdb
Symfony Blog: Symfony2 PEAR Channel
by Chris Cornutt June 27, 2011 @ 14:16:20
Fabien Potencier has a new post to the Symfony blog today - an announcement about the setup of a PEAR channel to make it easier to grab the various Symfony components individually.
One of the strengths of Symfony2 lies in its components; they define the building blocks of the framework and they can be used as standalone libraries. [...] The Symfony2 components have been available on Git for quite some time now, and as of today, I'm really excited to announce that they are also installable via the brand new Symfony2 PEAR channel, powered by Pirum of course.
Packages included in the list installable on the PEAR channel include:
voice your opinion now!
symfony2 pear channel components libraries
Padraic Brady's Blog: How Would You Engineer A PEAR2/Pyrus Distribution Architecture?
by Chris Cornutt June 21, 2011 @ 09:12:42
Padraic Brady has a new post to his blog asking you, the reader, for your suggestions on how to architect a distribution system for the PEAR2/Pyrus components.
With the idea of PEAR2 and Pyrus, I had hoped to see a renewal - the advancement of a PEAR architecture for the 21st Century. Instead, and this is just my opinion, PEAR2/Pyrus were a relatively simple iteration on a very old theme. [...] If the PEAR ecosystem has a failing, it is one of staggered evolution. Over time it has picked up additional features tacked on top of a base model.
He breaks up his thoughts on the future of PEAR2/Pyrus distribution into a few different topics - the issues he sees surrounding packaging (like static packaging definitions), suggestions for a dynamic channel aggregation system and overall usage of the PEAR system.
voice your opinion now!
feedback engineer pear2 pear pyrus architecture opinion
Test.ical.ly Blog: PHP 5.4 with traits, Doctrine 2.2 and then Symfony3?
by Chris Cornutt June 20, 2011 @ 12:07:36
On the Test.ical.ly blog there's a new post looking ahead to the next release of PHP, 5.4, and what it could mean for some of the popular tools out there - specifically Symfony and Doctrine.
It shouldn't be long until the first alpha version of PHP 5.4 will be released and with it there will be a lot of new features such as array dereferencing and traits to name but a few. What does that mean to the roadmaps of Doctrine and Symfony?
He mentions the experiments that are proposed on the Doctrine project that could be one of the major driving forces behind Doctrine 3. He points out that, as long as Symfony stays non-PHP 5.4-only, users will still have the choice of Doctrine 2 or 3. There are two issues he points out, though, that could cause problems for both projects - the choices Symfony makes in things like its quickstart guide and the DoctrinBundle vs Doctrine3Bundle situation that could come up.
voice your opinion now!
doctrine version symfony traits update
Sebastian Bergmann's Blog: Towards Better Code Coverage Metrics in the PHP World
by Chris Cornutt June 20, 2011 @ 08:10:57
Sebastian Bergmann has a new post to his blog talking about some of the future plans for better code coverage metrics for PHP applications (not just the statistics that we have now as generated from PHPUnit runs combined with Code_Coverage PEAR package and Xdebug).
Xdebug currently only supports what is usually referred to as Line Coverage. This software metric measures whether each executable line was executed. Based on the line coverage information provided by Xdebug, PHP_CodeCoverage also calculates the Function / Method Coverage software metric that measures whether each function or method has been invoked.
The various kinds of coverage they're planning the in future include statement coverage, branch coverage (boolean evaluation), call coverage, path coverage with an alternative of linear code sequence and jump coverage (LCSAJ).
voice your opinion now!
codecoverage metrics analyze code xdebug phpunit phpcodecoverage pear
PHPBuilder.com: PEAR HTML_Table Displaying Tabular Data in PHP
by Chris Cornutt June 02, 2011 @ 08:44:46
On PHPBuilder.com today Jason Gilmore has posted a tutorial showing you how to use the PEAR HTML_Table component to quickly and easily display tabular information on your site.
Because the task [of building tables] is so commonplace, personally I prefer to treat it like stamping out a widget, and rely on a drop in solution. While several such standardized solutions are available, I generally prefer to use HTML_Table, a great PEAR package which makes tabular data presentation a breeze. In this tutorial I'll walk you through several of HTML_Table's key features, additionally showing you how to integrate CSS and jQuery to create an eye-appealing and interactive tabular layout in no-time flat.
He helps you through the install (using the PEAR installer) and starts you down the right path with some sample code creating a table based off some example data from an array. He shows how to add headers, put in some CSS for styling them and for making the rows highlight on mouseover. He finishes it with the jQuery bit that uses the tablesorter feature to dynamically allow sorting of the table based on the values in each column.
voice your opinion now!
pear htmltable tutorial tabular data jquery css
Ryan Mauger's Blog: Using Twig with Zend Framework
by Chris Cornutt May 05, 2011 @ 08:28:18
Ryan Mauger has written up a new post about an integration he's done using the Twig templating engine (from be Symfony community) with his Zend Framework application to make view handling simpler.
Mostly I thought [what Twig offered] were silly things that were not really needed unless you had a team of designers to work with, however, during my exploration, a couple of things occurred to me that I had not considered about templating systems before. One being the enforced separation of concerns they provide; you simply cannot do anything from inside them which you shouldn't be, keeping your presentation very very clean. The second, being that they're not all as terrible as Smarty.
He helps you get Twig installed (via PEAR chnnel) and includes the code for an application resource and the changes you'll need to make to your application.ini to get things working. He uses a base controller setup, so he shows how to introduce a "twig()" method into that to help with rendering. Finally, there's a sample class included that includes two actions, both using this "twig()" method to pas the output data through the twig interpreter and out to the view.
voice your opinion now!
twig templating tutorial zendframework example pear
Symfony Blog: Symfony2 Getting easier
by Chris Cornutt April 29, 2011 @ 10:09:17
On the Symfony blog there's a new post about how Symfony2 is "getting easier" thanks to some recent changes with improved error handling and simpler configuration options.
With the release of the first beta approaching fast, our main focus has switched from adding new features to polishing existing ones. [...] Recently, Ryan and I have spent our time tweaking error messages, simplifying the code and the configuration, adding more documentation, and making things more consistent throughout the framework. The goal is to ease the learning curve and make things that people will need on a day to day basis simpler.
The changes they've made include three updates - better Twig error messaging, better configuration error messaging and some helpful changes to the Doctrine configuration to allow for auto-mapping of connections when the traditional one-database setup is used.
voice your opinion now!
symfony2 framework simile errormessage configuration doctrine
Padraic Brady's Blog: Wishing For A PEAR Channel Aggregator? Yes, Please!
by Chris Cornutt April 13, 2011 @ 12:56:23
In his latest post Padraic Brady talks about an effort that's been put out there (by Stuart Herbert) to come up with a PEAR channel aggregator - something he fully supports.
Since we seem to like blaming the PEAR Group, and getting that ball kicked back to us, it's time we did something useful. We've spent too much time ignoring PEAR as we grew apart from it with our frameworks, standalone libraries and custom plugin architectures. We're making life harder for ourselves in doing so. Stuart Herbert has posted a short article to gather requirements for a Pear Channel Aggregator. I strongly suggest that interested PHP programmers drop by and add a comment with some suggestions/feedback.
Stuart's suggestion has already gathered some good comments and suggestions from all around the community including some mentions of efforts from the Symfony project to do something similar.
voice your opinion now!
pear channel aggregator project
PHPBuilder.com: Using the PEAR Pager Package to Paginate MySQL Results
by Chris Cornutt April 13, 2011 @ 10:35:40
On PHPBuilder.com today there's a new tutorial about using the PEAR Pager package to paginate through results from a MySQL query. The package makes it easy to pass in a data set and handle the pagination requests and interface.
Fortunately a great solution [for paginating data] is at your disposal which has been created expressly for this purchase. The PEAR Pager package will not only handle all of the gory tracking details for you, but it can also create a linked navigation list which you can embed into the page as a navigational aide for the user. In this article I'll show you how to use Pager to easily paginate your database results in a structured and coherent way.
He walks you through installing the packaged (thankfully easy with the PEAR installer) and how to use it on a simple array dataset of college names. From there he moves into the database realm, creating a simple table that stores the same information and pulling the results out and into the Pager functionality.
voice your opinion now!
mysql paginate pear pager package tutorial
Till Klampaeckel's Blog: A roundhouse kick, or the state of PHP
by Chris Cornutt April 13, 2011 @ 08:23:03
Inspired by some of the recent discussions in the PHP community about the future of the language and the software that uses it, Till Klampaeckel has posted some of his own thoughts on the matter.
Last week the usual round of PEAR-bashing on Twitter took place, then this morning Marco Tabini asked if PHP (core) was running out of scratches to itch. He also suggests he got this idea from Cal Evan's blog post about Drupal forking PHP.
Till talks about a few different points others have made in their comments and tries to clear a few things up - the state of PECL, Drupal and PHP (and forking), PEAR and how some of this infighting might be doing more harm than good for the community.
voice your opinion now!
community opinion pear pecl drupal
Marco Tabini's Blog: Is PHP running out of itches to scratch?
by Chris Cornutt April 12, 2011 @ 12:02:31
In a new post to his blog Marco Tabini poses an interesting question - is PHP running out of itches to scratch in the evolution of the language?
think it's fair to say that the pace at which PHP core is being developed has slowed down considerably over the past couple of years, while the development of many projects based on it, like programming and application frameworks, has sped up and continues to grow at a fast pace. But this doesn't mean that we're running out of steam. The PHP ecosystem is simply refocusing outside of core, where it has a lot more freedom of action.
He suggests two reasons as to why this slowdown might be happening - first that there's not a sense of strong leadership in the core development group (a feature of the project done on purpose) and the change to move new library support out to PECL and PEAR instead of directly into the core of the language.
The risk facing us, as I see it, is not that Drupal, or WordPress, or whoever may decide to fork PHP or abandon it altogether. Rather, the problem is that there is no real way for these projects to provide upstream positive feedback to PHP core.
voice your opinion now!
opinion pecl pear core library development project leadership
Stuart Herbert's Blog: Dealing With PEAR Dependency Quirks
by Chris Cornutt March 28, 2011 @ 11:09:56
Stuart Herbert has a new post to his blog today that shares some helpful hints about dependency quirks that can come with using PEAR packages and the PEAR installer.
To save myself a bit of effort, I thought it would make sense to make my API client reuse PEAR's existing HTTP_Request2 component. No sense in re-inventing the wheel, I thought. But that's where my troubles began. [...] There are a few quirks in the way that the PEAR installer handles version numbers, and you need to know how to deal with them if you're going to re-use PEAR project components in your own apps.
He shows how a dependency can be set up for the HTTP_Request2 package as a part of the update to his project. He talks about changes to the project's package.xml file and the trick with version numbering to get the latest. In this case, the latest is a non-stable alpha/beta component and the package.xml file needs some special handling to cooperate there (version, stability, release, api and min/max).
voice your opinion now!
pear dependency quirk tutorial httprequest2 package beta version
Dan Scott's Blog: Creating a MARC record from scratch in PHP using File_MARC
by Chris Cornutt March 04, 2011 @ 08:40:08
Dan Scott has posted an example of how to create a MARC record (machine-readable cataloging, more details here) from scratch with the help of the File_MARC PEAR package.
In the past couple of days, two people have written me email essentially saying: "Dan, this File_MARC library sounds great - but I can't figure out how to create a record from scratch with it! Can you please help me? Yes, when you're dealing with MARC, you'll quickly get all weepy and get help from anyone you can.
His example code is pretty simple - load the PEAR package into the script, create the record object and start adding fields to it. He shows various output methods ("pretty print", writing the raw data to a file, etc.) and the output to various other data structures like JSON and XML.
voice your opinion now!
marc record create filemarc pear package tutorial
Till Klampaeckel's Blog: Contributing to PEAR Taking over packages
by Chris Cornutt February 22, 2011 @ 14:45:53
Till Klampaeckel has posted a few suggestions for you if you'd like the take the reigns of a PEAR package when it's not maintained.
One of the more frequent questions I see on the mailing lists and IRC is, "How do I take over a package?". Very often people start to use a PEAR package and then at some point encounter either a bug or they miss a certain feature. The package's state however is inactive or flat unmaintained.
He recommends a few different courses of action - first asking if there's a way to help out, then stepping it up and pushing the fixes in yourself and, finally, deciding if you really do want to maintain the package (and show it by contributing).
voice your opinion now!
pear contribute package manage opinion
Zend Developer Zone: Using the Stack Exchange API with PHP (part 2)
by Chris Cornutt January 21, 2011 @ 11:12:22
The Zend Developer Zone has posted the second part of a series from Vikram Vaswani about using the Stack Exchange API to pull questions and comments users have posted to the site. In this second part of the series he shows how to get more information about those users and their activities.
The thing to remember about questions, answers and comments, though, is that they don't exist in a vacuum. They're created by users, and it's the users that make the site tick. That's why the Stack Exchange API includes a large number of methods designed to let developers access user profiles and timelines, and unearth the relationships between users and their posts. This article will focus primarily on this dimension of the Stack Exchange API, illustrating how to search for users, obtain user profiles and timelines, and retrieve information on a user's questions, answers, comments, badges and tags.
You'll need to get the StackPHP PEAR package to follow along with the code examples (it does some of the hard work for you). He shows how to:
- Grab a list of users ordered by reputation
- Search for usernames matching a string
- Get badge information (in general and for a user)
- Finding a user's activity timeline
Near the end he also includes an example of using the Zend_Paginator component of the Zend Framework to filter down the results to a more manageable size.
voice your opinion now!
stackoverflow api tutorial pear stackphp
Chris Hartjes' Blog: Smarter DB Migrations using Zend Framework and Doctrine 1.2
by Chris Cornutt January 20, 2011 @ 10:11:39
Chris Hartjes, after finally figuring out an issue with database migrations with Doctrine on a Zend Framework application, has posted about the process to his blog today. As he notes:
This posting is a lesson on the value of actually looking at the source code of a third-party library when you are trying to figure something out...
His problem wasn't with the features of Doctrine and how easy it made to automate things in his environments (continuous integration). His issue was that Doctrine wanted to run all of the migrations every time it was executed. Upon closer inspection, he found the key - a migration_version table in his database that held current migration information. He includes a simple Zend Framework-based script he's now using get the latest value from that table and execute only the migrations after that. The migrations are executed in order - he recommends using a timestamp or formatted date on the filename to set the order.
voice your opinion now!
zendframework migration doctrine tutorial version
Ibuildings techPortal: Database Version Control
by Chris Cornutt January 11, 2011 @ 12:42:08
On the Ibuildings techPortal today Harrie Verveer has a new post looking at database version control - one of the more difficult topics for development groups - and some of the technology that can be used to help make it a bit simpler.
Database version control is something that most developers have to deal with regularly, yet only a few have actually thought about what solution might be best for them. Most people have a solution that sort of works for them, but when you ask them about the subject they are pretty convinced that there must be some better way to manage database changes, they're just not entirely sure what that solution is - but the silver bullet must be out there somewhere, right?
He starts where most developers start - their own custom script. It usually will take in a series of patch files and apply them one by one. In this case a "patch level" is stored somewhere (file/database) and is checked when the deployment is done. He points out a few issues with this method including patch naming issues and branching. Taking a step up the technology tree, he looks at other solutions like Phing+DBDeploy, Liquibase, and Doctrine migrations to try to help you find your project's "silver bullet".
voice your opinion now!
database version control custom phing liquibase doctrine migration
Zend Developer Zone: Using the Stack Exchange API with PHP (part 1)
by Chris Cornutt December 30, 2010 @ 13:04:02
On the Zend Developer Zone today the first part of a series from Vikram Vaswani has been posted. This new set of articles will look at how to use the Stack Exchange API from your PHP applications.
The thing about Stack Overflow, though, is that it has a geeky secret of its own. Like many Web 2.0 applications, it exposes its data to the public via the Stack Exchange Web service API, making it possible to develop customized applications that run on top of the base service. This API allows access to a number of important functions, including searching for questions, retrieving answers and comments, accessing user profiles, and working with tags and badges. It's also pretty easy to integrate this API into a PHP application - and this two-part article will show you how!
In part one he introduces you to some of the conventions and tips you'll need to know when reading through the article. He shows how to get and parse a sample response (with json_decode). He also uses the proposed StackPHP PEAR package to make requests for general question information, specific details, tags, comments and search results.
voice your opinion now!
stackexchange api tutorial stackphp pear package json
Robert Basic's Blog: A real gem - PHP_CompatInfo
by Chris Cornutt December 28, 2010 @ 09:34:40
In this new post to his blog Robert Basic takes a look at what he calls a "real gem" in defining the requirements of his application - PHP_CompatInfo.
Last night I was pondering how nice would it be to have a tool of some sort, that would simply spit out what version of PHP does my app require. Something like: here are my .php files, what PHP version and/or extensions do I need for it? First I thought about jumping right in and writing it myself, but hey, this kind of a tool sounds way to useful not to be written already! After a bit of a googling there it was: PHP_CompatInfo. A nice PEAR package that can tell me everything I want about my code and even a bit more.
He includes a code snippet showing it in action. It's a basic example that defines the driver type to use, options and the directory to parse through (using parseDir() naturally). Other output formats are available too like CSV and HTML.
voice your opinion now!
phpcompatinfo pear package compatibility requirement
Sameer Borate' Blog: Creating SQL schemas with Doctrine DBAL
by Chris Cornutt December 22, 2010 @ 14:25:53
On his blog today Sameer Borate has a new post looking at using Doctrine DBAL to make schemas rather than having to make them by hand each time (can be very useful for reloads with fixtures).
A tedious task during web development is that of database schema creation. A schema containing a few tables comprising of a small set of rows is quick, while that containing dozens of tables and large numbers of columns is a tedious process. I usually resort to a small php script with some regular expression tossed in to automatically create a schema from a text file definition. But that is a little buggy as I've to manually add the indexes and other small things. Now that Doctrine has released a DBAL library, this will provide a nice ability to automatically create sql schemas.
He introduces the DBAL abstraction layer and includes a basic script to create a schema for a MySQL database, manually adding the columns and setting up things like primary keys and foreign key constraints. He also includes the SQL statements that it will generate and execute on your Doctrine-based connection.
voice your opinion now!
sql schema doctrine generate dbal mysql
PHPBuilder.com: Create a PHP-based Twitter Client with the PEAR Services_Twitter Package
by Chris Cornutt December 09, 2010 @ 14:57:16
On PHPBuilder.com there's a new tutorial from Jason Gilmore about how to create a PHP-based witter client with the help of the Services_Twitter package from the PEAR repository.
Entirely reinventing the wheel seems foolhardy, and so I wanted to base the project on a solid foundation, including a quality PHP-based Twitter library. That library turned out to be PEAR's Services_Twitter package. In this article I'll introduce you to this powerful package, which although still in beta already offers all of the features you'll need whether you want to build your own Twitter client or simply add Twitter-specific functionality to an existing application.
He includes instructions on how to install the package, register the application as a service and connect it via OAuth. There's also a full code listing included showing how to make the authentication from the PHP app and how to grab the latest tweets from a user.
voice your opinion now!
pear servicestwitter package client twitter tutorial
Jani Hartikainen's Blog: How to create Doctrine 1-style Soft-Delete in Doctrine 2
by Chris Cornutt December 06, 2010 @ 13:02:08
Jani Hartikainen has posted his technique for making the Doctrine version 1 style "soft delete" in your Doctrine 2 powered application.
Doctrine 1 has the concept of behaviors which you could add to your models. One of these was the soft-delete behavior, which allowed you to "delete" records without really deleting them. Doctrine 2 does not have behaviors due to various reasons. However, I needed a way to have a model which worked like soft-delete. Let's see one approach to creating such behavior in Doctrine 2.
He introduces the idea of a "soft delete" - essentially a flag that gets set to let the rest of the application think that row is essentially deleted. He shows you how to create the similar functionality via a repository that filters the data for you. He includes code to help you along, defining the find/findOneBy/findBy and the example repository that lets you set an "is deleted" property on the object.
voice your opinion now!
doctrine soft delete repository filter
Developer.com: 10 Powerful PEAR Packages
by Chris Cornutt December 02, 2010 @ 09:06:27
On Developer.com there's a new article with what they think are the top ten PEAR packages that every developer should know and use in their applications.
PHP developers also have another community-driven treasure trove at their disposal, one which is host to almost 600 high-quality libraries yet never seems to garner the attention it deserves. I'm referring to the PHP Extension and Application Repository, better known as PEAR, and in this article I'll try to shine the spotlight just a bit brighter on this fantastic community resource by highlighting 10 useful PEAR libraries (better known as packages) that have become an indispensable part of my programming toolkit.
Included in their list of "Top Ten" are things like:
voice your opinion now!
pear package topten useful
Ruslan Yakushev's Blog: How to install PHP PEAR and phploc on Windows
by Chris Cornutt November 25, 2010 @ 12:38:12
Ruslan Yakushev has a recent post about installing the PEAR tools and installing an example package, phploc.
PEAR (short for PHP Extension and Application Repository) is a framework and distribution system for reusable PHP components. In includes many useful tools and components that can be easily downloaded and installed by using PEAR package manager. This post describes how to install and configure PEAR package manager and then how to use it to install a PEAR package. An example PEAR package used in this post is phploc, which is a tool for measuring the size of PHP projects.
He recommends installing PHP via the Web Platform Installer and use the PHP 5.3 VC9 non-thread-safe package with the PHP Manager. All of the commands needed are included as well as some of the sample output that results. Once you get PEAR installed, then they show how to discover the PEAR channel and "pear install" the right packages for phploc (including the dependencies it might need).
voice your opinion now!
phploc windows pear install tutorial wpi
Ruslan Yakushev's Blog: PHP 5.3 and PEAR available in WebMatrix Beta 3
by Chris Cornutt November 11, 2010 @ 12:55:10
Ruslan Yakushev has a new post about a major update to the latest beta release of the Microsoft WebMatrix tool - the update of the PHP version to support 5.3 and the inclusion of PEAR.
WebMatrix Beta 3 release has been announced recently. This release includes many new cool features that are described in release announcement and in the Web Deploy team blog. In addition to all those improvements, WebMatrix Beta 3 has much better support for PHP.
The updates make it possible to use 5.3 (prior versions only supported 5.2.x), an update to allow PHP to be enabled on a new empty site and the inclusion of PEAR whenever PHP is installed. He includes a few screenshots and instructions to help guide you through the process of getting 5.3 set up. PEAR is automatically installed when you install this latest PHP update.
voice your opinion now!
webmatrix microsoft update pear version
Jose de Silva's Blog: Speeding up your application with Cache_Lite
by Chris Cornutt November 04, 2010 @ 13:53:49
In a new post to his blog Jose de Silva takes a look at how using the Cache_Lite PEAR package can help to speed up your application by reducing overhead caused by data fetching.
Cache_Lite is one of the fast, light and reliable cache system for PHP. It's an extremely easy and small learning curve system to work with. This post will try to make you a light introduction to PHP Cache_Lite.
He starts from the beginning - installing the package through the PEAR installer and setting up a basic configuration for a new Cache_Lite object in a script. Using this object you can test for the existence of a cached value or set a new one. The configuration allows you to define the "time to live" before the records expire.
voice your opinion now!
tutorial cachelite pear package
DZone.com: From Doctrine 1 to Doctrine 2
by Chris Cornutt November 04, 2010 @ 12:48:21
On DZone.com today there's a new article from Giorgio Sironi about making the switch from Doctrine 1 to Doctrine 2 and some of what might be involved.
Doctrine 2 is an implementation of the Data Mapper pattern, and does not force your model classes to extend an Active Record, nor to contain details about the relational model like foreign keys. [...] Note that you will have to run your application of PHP 5.3 for Doctrine 2 to work, mainly because of the use of namespaces in it.
He talks about some of the other differences including maintaining PHP classes and the metadata in them rather than just a YAML schema to map to your database. There's also a difference in how to interact directly with the Doctrine engine. Direct access has been replaced with a dependency injection approach.
voice your opinion now!
doctrine orm database migrate version
Amit Singh's Blog: Installing PEAR and PHPUnit on WAMP and Windows 7
by Chris Cornutt November 03, 2010 @ 12:03:47
Amit Singh has a recent post to his blog with step-by-step instructions on how to get PEAR, PHPUnit and a WAMP installed and working on Windows 7.
In the project that i am currently working on, we decided to use PHPUnit for doing our unit testing, and i found that it was not a straight forward thing to install that I had thought it would be. I had to start by installing Pear, and as soon as i type 'go-pear' in command prompt and pressed enter key I got my first error. So here are the steps needed to install PEAR and PHPUnit error free on WAMP.
Since the steps to install the WAMP server are pretty easy, he focuses on the other two technologies. He breaks up the install into the steps for PEAR and then the steps for installing and configuring PHPUnit. Obviously you'll need to change some paths for your system, but it's a pretty simple process and you should be up and running in no time.
voice your opinion now!
pear phpunit wamp windows7 install tutorial
Zend Developer Zone: Using the Digg API with PHP and PEAR
by Chris Cornutt November 03, 2010 @ 08:42:26
On the Zend Developer Zone there's a recent article about using APIs, specifically on how to use the Digg API with the Services_Digg2 PEAR package.
A few weeks ago, a client asked me to add a feed of interesting news stories to his Web application. Naturally, my thoughts turned immediately to Digg, which invariably has something interesting to read and which also offers a Web service API [...] A little Googling, and I found the PEAR Services_Digg2 class, which exposes a neat little PHP interface to the Digg API. As you might imagine, with all these tools to hand, it didn't take long to quickly integrate a feed of Digg stories into the application.
He walks you through the installation of the package (a one command step) and a secondary package you'll need due to Digg's authentication, HTTP_OAuth. He includes a request and response example (returned in JSON) as well as several code examples for sample requests, searching, working with comments on posts, post comments, "digg" stories and follow other users.
voice your opinion now!
digg api pear package servicesdigg2 tutorial
PHPBuilder.com: Enforcing Coding Standards with PHP_CodeSniffer
by Chris Cornutt October 22, 2010 @ 08:40:59
Developing applications has become simpler and simpler these days and the multitude of IDEs out there can help you keep all of your files organized and linked together so you know everything is in its place. There's one thing that only a handful out there can do, though - enforce coding standards. Thankfully, there's a tool that can help you keep your code following down the right path and PHPBuilder.com has a new tutorial about using it - PHP_CodeSniffer.
Although defined according to formal grammar and syntax, programming languages -- like their spoken counterparts -- often leave their users with a great deal of leeway for creative expression. [...] It can even be singularly counterproductive if you do not maintain stylistic consistency across projects, as you'll need to continuously re-acclimate to differing syntactical variations.
The PHP_CodeSniffer tool runs your code through a validation process and checks its structure against a coding standard (like the PEAR standard) and ensure it's formatted correctly. The tutorial shows you how to use the "phpcs" executable to test PHP, Javascript and CSSS files (using the Squiz standard).
voice your opinion now!
coding standard phpcodesniffer sniffer pear squiz
Sebastian Bergmann's Blog: PHPUnit 3.5 Upgrading Woes
by Chris Cornutt October 22, 2010 @ 07:42:23
If you've been having issues upgrading to the latest version of PHPUnit (v3.5), Sebastian Bergmann might have the answer to your problems that's related to the PEAR installer and this bug.
The new dependencies of the PHPUnit package, such as PHPUnit_MockObject for instance, are installed first. The PHPUnit package itself is installed last. And herein lies the problem: PHPUnit_MockObject installs the new version of MockObject/Generator.php before the PHPUnit package is upgraded. This upgrade deletes the MockObject/Generator.php file as it previously belonged to the PHPUnit package.
He includes two complete file listings showing the difference in the structure before and after the upgrade. The PEAR installer is at fault due to a misunderstanding it has about where the MockObject/Generator.php file belongs. The only way to fix this, currently, is to force install the new subpackages instead of just an update - DbUnit, PHPUnit_MockObject and PHPUnit_Selenium. Instructions and a resulting files tree are included so you can insure your install is correct.
voice your opinion now!
phpunit upgrade pear installer mockobject
UncleCode.com: Install PHPUnit Manually without Pear for a Single Project
by Chris Cornutt October 12, 2010 @ 12:39:40
From the UncleCode.com blog there's a recent post showing you how to install PHPUnit manually without PEAR if you either don't have the access or just want to install it yourself.
This tutorial is an easy start to test your PHP source code which is build using classes i.e. OOP's with/without wamp/xamp doesn't really matter. The key to PHPUnit installation is set correct include path of your PHPUnit directory and extend correct phpUnit class in test case file.
They give you a quick eight step process that'll have you up and running in no time (including the download of the latest PHPUnit version). He shows how to set the paths in a sample unit test file to point to the right location for PHPUnit based on the root directory of your application. The runner can then find the correct files and classes when you run your tests.
voice your opinion now!
install phpunit manual custom tutorial pear adhoc
ServerGrove Blog: Creating indexes for your Doctrine ODM documents with Symfony 2
by Chris Cornutt October 08, 2010 @ 08:24:41
On the ServerGrove blog there's a new post showing you how to create indexes for your Doctrine ODM documents in a Symfony 2 application.
Creating indexes in NoSQL / Document-based databases is quite different compared to traditional relational databases. Since the former are schema-less (there is no table creation), indexes do not get created when the collection or the document is created or inserted. Here is a quick tip that will create all the indexes defined in your documents when using Symfony 2 and Doctrine ODM for MongoDB. Indexes are a great way to speed up your queries, in fact, it is a crime not to include them in your documents.
Adding the index is as easy as putting a new annotation on the property in its document class (for @Index) and run a bit of code in Symfony to build it out. The two lines you'll need to execute are included in the post.
voice your opinion now!
symfony document orm doctrine index tutorial
Nurul Ferdous' Blog: Here is my 2 cents on Doctrine (ORM)
by Chris Cornutt October 04, 2010 @ 11:20:31
Nurul Ferdous has posted his "two cents" on Doctrine - his thoughts on the good and bad things about the popular ORM tool.
What is Doctrine? Doctrine is a popular ORM for PHP which works with RDBMS via PHP objects. This is built inspired by Hibernate from JAVA. This acts as an abstraction layer between PHP and RDBMS.
In his list of good things about Doctrine are things like its hiding of business logic, automatic CRUD, automatic modification of DQL queries, migrations and unit testing interfaces. On his "bad list" are things like not being able to use foreign keys as an identifier, heavy emphasis on an "id" column, not all data types are in DBAL and the SQL constructs missing in DQL. He also includes a scenario where he definitely not use Doctrine - a specific example from a project he just worked on that pushed the limits of the tool.
voice your opinion now!
doctrine opinion good bad example project
Daniel Cousineau's Blog: Doctrine 1.2 MSSQL Alternative LIMIT/Paging
by Chris Cornutt September 17, 2010 @ 11:34:03
Daniel Cousineau has a new post to his blog today looking at an alternative that can be used for pagination in your MSSQL queries than the trick with TOP and reversing the ORDER BY in Doctrine.
As ugly as this technique is, it works. The problem is it requires an extreme amount of intelligence or an extreme amount of simplicity in the query in order for an automated system like Doctrine to be usable. The biggest caveat with this technique is good goddamned luck paging your query if it doesn't have an ORDER BY. And sometimes queries that are complex enough break the modified Zend_Db code. There exists an easier MSSQL paging technique. Using features first available in SQL Server 2005, with only 1 subquery you can mimic MySQL's LIMIT clause with ease.
He includes the query that will make it happen (the SQL for it) and then the implementation as an adapter you can use to get it to cooperate in your Doctrine queries.
voice your opinion now!
mssql doctrine limit paging adapter
Gonzalo Ayuso's Blog: Building an ORM with PHP
by Chris Cornutt September 13, 2010 @ 12:44:14
In this new post to his blog Gonzalo Ayuso looks at building an ORM (don't worry, he recommends something like Doctrine first) as an exercise to understand how they're constructed and how one could fit his goals.
What's the motivation for me to build this ORM? The answer is a bit ambiguous. I like SQL. It allows us to speak with the database in a very easy way. [...] So the idea I figured out was to create a set of classes based on my tables, in a similar way than traditional ORMs to help me to autocomplete the fields and table names.
He creates a simple example with a "test" table with three columns with a mapped class (in the "Orm" namespace) that will allow IDEs to follow down the path to fetch the data from the "id", "field1" and "field3" columns. The complete code listing for his example is at the end of the post - PHP 5.3 friendly, of course. Some trigger and scaffolding examples are also included.
voice your opinion now!
orm tutorial example database doctrine autocomplete
Jonathan Wage's Blog: Blending the Doctrine ORM and MongoDB ODM
by Chris Cornutt August 26, 2010 @ 13:34:40
On his blog today Jonathan Wage has posted a tip on getting MongoDB connections and queries to work through the Doctrine ORM layer:
Since the start of the Doctrine MongoDB Object Document Mapper project people have asked how it can be integrated with the ORM. This blog post demonstrates how you can integrate the two transparently, maintaining a clean domain model. This example will have a Product that is stored in MongoDB and the Order stored in a MySQL database.
His code shows how to define the document and entity for the connection (a Product and Order) and creating an event subscriber to lazy load the product. He creates a sample Product and an Order for it and save them to the database. He also includes code to pull an order back out by its ID number and get an Order object back out (with Product data inside).
voice your opinion now!
doctrine orm mongodb document entity subscriber event tutorial
Matthew Weier O'Phinney's Blog: Autoloading Benchmarks
by Chris Cornutt August 18, 2010 @ 10:14:59
Matthew Weier O'Phinney has a new post to his blog (following this post on directory iteration for autoloading) with some of the benchmarks of different methods he tried for automatically loading the libraries his scripts needed on demand.
During the past week, I've been looking at different strategies for autoloading in Zend Framework. I've suspected for some time that our class loading strategy might be one source of performance degradation, and wanted to research some different approaches, and compare performance. In this post, I'll outline the approaches I've tried, the benchmarking strategy I applied, and the results of benchmarking each approach.
His testing included a baseline of the Zend Framework 1.x series loading, a naming/class standard following the PEAR standards and class mapping with file/class name pairs. He includes his benchmarking strategy and the scripts he used to run the tests (on github here). He ran them both with and without opcode caching to give a better overall performance view.
voice your opinion now!
autoload benchmark classmap spl pear psr0
Solar Blog: Switch to Pirum PEAR Server
by Chris Cornutt July 12, 2010 @ 10:13:46
On the Solar framework blog today there's a quick new post about a change they've made to their distribution method:
I just switched the solarphp.com PEAR server over from the old Chiara_PEAR_ServerPirum, then plan and execute the conversion and server update. The presentation is not as slick as I'd like, but it's dead-stupid simple to set up, and I can tweak the CSS etc. later.
Pirum is a simpler alternative for a PEAR channel server manager that aims to make it simpler than some of the more complex options offered in the past. You can install Pirum from its PEAR server.
voice your opinion now!
pear server solar framework pirum
Kevin Schroeder's Blog: Deployment Series
by Chris Cornutt June 28, 2010 @ 08:22:19
If you're interested in the deployment of PHP applications, you'd do well to check out a series of articles Kevin Schroeder has posted to his blog talking about different methods for moving your site out when it's ready for the world to see.
His articles cover:
This last option, while a bit more difficult than some of the others, seems to becoming more and more popular as a self-contained, easy to deploy method that's very controllable.
voice your opinion now!
deployment package pear sourcecontrol rsync series
Developer.com: Doctrine Object Relational Mapping for Your PHP Development
by Chris Cornutt June 14, 2010 @ 10:22:06
New on Developer.com today there's a new article looking at one of the more powerful ORM tools available for PHP - Doctrine.
Because of the relational database's pivotal role in driving Web applications, a great deal of time and effort has been put into creating tools that not only simplify the task of mapping database tables to a programming language's object-oriented class structure, but also facilitate the management of your data and schemas over the project lifecycle. [...] The PHP community also has a powerful database integration tool at their disposal: a project known as Doctrine.
They help you get started with this powerful tool by showing you how to get it installed, create a sample schema and loading some fixtures (base data). There's also a quick snippet of code showing you how to grab information from a sample user table and display the name of the user.
voice your opinion now!
doctrine object relational map orm tutorial
Michael Kimsal's Blog: Zend Framework starter kit - zfkit.com
by Chris Cornutt June 10, 2010 @ 13:47:53
Michael Kimsal has put together a Zend Framework starter kit currently posted over on github here.
Feel free to fork it and send me pull requests. There's a load of things I'd like to do to/with it, including a default basic authentication and user mgt system, a basic forms generator, some menu stuff on the side, and some other small stuff. It's got Doctrine built-in, and ready to go with a sample book/author object set, although no sample *data* yet, nor any examples of how to use the code specifically. Maybe I'll add some of that soon.
The ZFKit brings helps you get started quickly by giving you an example of a site that combines Doctrine, PHPUnit and the Zend Framework into one "ready to go" bundle.
voice your opinion now!
zfkit zendframework doctrine quickstart phpunit
Developer.com: Creating Complex, Secure Web Forms with PHP and HTML_QuickForm2
by Chris Cornutt May 11, 2010 @ 11:05:51
New on Developer.com today there's a tutorial looking at creating complex, secure forms with the HTML_QuicForm2 PEAR package. This package will give you more control over the form, the validation it performs and the overall security it automatically handles.
For PHP developers, HTML_QuickForm2 PEAR package provides a programmatic interface for rigorously defining form controls, value requirements, and user notifications. Using HTML_QuickForm2 helps these developers create usable and secure Web forms without sacrificing visual appeal. This solution takes much of the guesswork out of secure forms development, allowing you to create robust forms with minimal time investment. In this article, I show you how to take advantage of HTML_QuickForm2 to streamline the creation and validation of complex HTML forms.
They help you get the package installed (if all goes well, it's just a call with the "pear" command-line tool) and how to create a simple form for accepting a user's name and email address. They modify it a bit to create another example - one that takes in a preferred format for the email that would be sent over to the user. They also work in the concept of required fields and how to show the error messages that might result from those being empty.
voice your opinion now!
complex htmlquickform2 pear tutorial form
Court Ewing's Blog: The Best Models are Easy Models
by Chris Cornutt May 10, 2010 @ 15:51:57
In a recent post to his blog Court Ewing talks about what he sees as one of the most important parts of any framework-based application - good, easy models that are simple to use and well structured.
By treating your models as nothing more than a place to dump your data, you are doing yourself and your application a severe disservice; your business logic is going to be scattered throughout the rest of your application, and you will have a progressively more difficult time as you try to maintain and build upon your existing system. Do not fall into the anemic model trap.
He gives examples of good models (based on how Doctrine 2 handles them) to work with the data for a sample blogging application. His main "Article" model pulls from an abstract one to help define some relationships and magic methods to handle class properties in a protected and private way, depending on the context. He finishes the post with an example of how to use these new model classes to interact with his blog data.
voice your opinion now!
model anemic tutorial easy doctrine
Anna Filina's Blog: Doctrine Translation in leftJoin()
by Chris Cornutt April 26, 2010 @ 11:39:33
In a recent post to his blog Anna Filina looks at internationalization in Doctrine and how Symfony auto-builds things to take care of it for you.
If you use Doctrine, then you probably know how lazy loading can hurt your performance. I carefully craft every query to everything that I need in one shot, but only what I need. One thing that evaded me at first was the i18n part. I am pleased with the way Doctrine + symfony magically creates all my models and database tables with i18n support.
She talks a bit about the internationalization (i18n) support is put into the schema.yml file and the bit of confusion she had over how to handle a left join using its structure. The key lies in the Translation relationships.
voice your opinion now!
doctrine translation left join i18n internationalization
PEAR Blog: PEAR in March 2010
by Chris Cornutt March 22, 2010 @ 10:07:09
On the PEAR blog there's a recent post looking at the month of March so far and some of the PEAR-related happenings that have already popped up.
After a quiet holiday season, the PEAR community has started rumbling again. [...] If this level of activity is anything to judge by, the future of PEAR looks bright for 2010!
Updates this month include a mention of the PEAR project on digg.com, the release of several new package versions for things like Facebook and the Mail package. They've also set up a continuous integration environment to help make the maintenance and testing of the code in the new releases simpler. There's also mentions of Phirum and PEARFarm and how they're lowering the barrier for PEAR installation everywhere.
voice your opinion now!
march pear community package channel installer
Michael Kimsal's Blog: Zend Framework and Doctrine integration - autoloading of doctrine models
by Chris Cornutt March 04, 2010 @ 08:30:11
Michael Kimsal has a new post today looking at using Doctrine models in a Zend Framework application and how to get them to autoload when you need them with the help of Zend's Zend_Loader_Autoloader.
I would have expected there to be some explicit reference to how to set this up, but the best I can find are general examples where the Doctrine models directories are appended to the include_path in a ZF index file. Shouldn't there be a way to explicitly have the Doctrine subsystem react to requests for models as well?
He works through the process he followed, including the possibilities of extending the Doctrine Core and accessing the $_modelsDirectory property, but didn't have much luck because of how Doctrine forces the autoloading. He asks for help and gets some good suggestions in the comments on where to look fro documentation and a possibility of skipping the Doctrine loader all together.
voice your opinion now!
zendframework doctrine orm autoload
Chris Hartjes' Blog: Sorting Relationship Results In Doctrine 1.2
by Chris Cornutt February 05, 2010 @ 10:51:32
Doctrine allows you to set up relationships to link data in various tables together. Unfortunately, those aren't always in the order they need to be in. In a new post to his blog Chris Hartjes shows you how to sort these relationship results just by adding a simple line to your request.
I started digging around via search engine. Took me about an hour to find the solution. First, it took me half the time to dive deep enough to find out WHERE I can define the default sort order. Surprisingly, it was in an area that made total sense but I could not find before.
You can see an example of it in the "hasMany" call in his code snippet - the addition of the "orderBy" option and the value showing the sorting order. Here's the StackOverflow page that gave him the answer he needed.
voice your opinion now!
relationship doctrine sort tutorial orderby
Till Klampaeckel's Blog: Quo vadis PEAR?
by Chris Cornutt January 29, 2010 @ 11:24:46
Till Klampaeckel has a recent post about PEAR versus PEAR Farm on his blog detailing what each is and how to use the PEAR Farm to get your software out there.
With the release of Pirum, I'm really excited to see two public PEAR channels that aim to make PEAR a standard to deploy and manage your applications and libraries. One is PEARhub and the other is PEAR Farm. I think I'm gonna stick with PEAR Farm for a while, so this blog entry focuses on things I noticed when I first played with it. [...] A lot of people mistake these new channels for the wrong thing. They think that this will eventually replace PEAR. I don't think it will - ever.
He shows how to get the PEAR Farm libraries installed (via the PEAR installer) and how to set up your project with the pearfarm command-line tool. He also offers a few "gotchas" and tips to help you with a few of the issues he saw along the way. You can get an idea of the end result by looking at Till's PEAR Farm page.
voice your opinion now!
pear pearfarm tutorial package
ZendCasts.com: Logging in Users using Doctrine and Zend_Auth
by Chris Cornutt January 27, 2010 @ 09:38:52
The next ZendCast in the user authentication with the Zend Framework's Zend_Auth has been posted to the ZendCasts.com site today. In this new screencast, they look at how to integrate it with Doctrine to automatically validate users against the information in your databases (following up on this first part of the series).
Here's the second part of my Doctrine / Zend_Auth example. In 15 minutes, we create a logout, login and protected area that's reliant on the ZC_Auth_Adapter adapter we created in last week's video. Notice how there's no code in the IndexController exposing the authentication implementation,
You can grab the code to follow along or build it as he goes. You'll need a copy of Doctrine up and working to keep up, though.
voice your opinion now!
zendframework zendauth tutorial screencast doctrine
Rdavid.net: My Zend Framework Model Layer Part Service, Part ORM
by Chris Cornutt January 21, 2010 @ 13:09:12
In a new post on the Rdavid.net blog there's some discussion about Zend Framework models, the best approach and a "Service Class" idea.
After some more thought and lots of research on the subject, I've come to a solid point where I actually have something to try out which seems semantic aside from the naming of the class (Service Class) '" but this is derived from what some people are talking about in ZF circles starting from Matthew Weier O'Phinney who was coining it as the "Gateway to the Domain" from early on, then later changing it to "Service Class".
He defines what his service class idea is - a layer between the database and each of the models that allows them to be agnostic about what kind of service they're using. He also breaks down some of the key points around his approach including the fact that the Model Service can create Forms and that the Model Service can use the Zend_Cache component directly for improving performance. Be sure to check out the comments for thought from other Zend Framework developers.
voice your opinion now!
service model layer orm doctrine
Rdavid.net: Test Results on Memory Usage of Zend Framework and Doctrine with APC
by Chris Cornutt January 18, 2010 @ 13:38:01
On Rdavid.net there's a post with the results from some tests run on hos much memory the Zend Framework and Doctrine used both with and without the APC caching.
I have decided to run with Doctrine as my Domain Model in Zend Framework projects. The thing is, if I'm going to commit to this, I need to know that applications I build in the future with the Zend Framework while using Doctrine as an integral part of the Model layer will not take performance hits from things like memory usage. With Doctrine doing a _lot_ of magic, I thought that this would be something that I wanted to see for myself. 4MB Memory to execute a simple Query?!?! Ffffff#$#!!!!
He includes the code for his testing procedure - creating a basic Doctrine object and running a "fetchOne" query and measuring the memory consumption with the memory_get_usage function. His results with the APC caching came out faster by about 60-70 percent.
voice your opinion now!
zendframework memory usage doctrine benchmark
Benjamin Eberlei's Blog: Application Lifecycle Management & Deployment with PEAR & PHAR (revisited)
by Chris Cornutt January 18, 2010 @ 09:25:05
In a recent post to his blog Benjamin Eberlei looks at how PEAR and PHAR can affect the lifecycle of the development of your application following some of the feedback he got from a previous article on the same topic. In this revised version he talks about the open source project he's started, Pearanha, to bundle all of these ideas together.
First of all, yes the presented solution was somewhat complex, partly because it is still a proposed idea and definitely up for optimizations. However I am still very convinced of my approach, something I should discuss in more detail.
He mentions some of the downfalls that PHP applications have had up until now as far as ease of deployment and the maintaining of dependencies. Most of the suggested solutions aren't optimal, so a system using the PEAR installer would have to overcome some of them and keep it simple to use. Benjamin has taken the PEAR installer and laid his new Pearanha tool on top of it to help you create custom PEAR installer scripts.
voice your opinion now!
pear deployment pearanha installer
SitePoint PHP Blog: Introducing pearhub
by Chris Cornutt January 08, 2010 @ 09:11:20
In this new post to the SitePoint PHP blog Troels Knak-Nielsen looking at a new PHP-centric service for creating a resource like the Ruby on Rails "gems" but for PHP software - pearhub.org.
I think services like these are an important reason why gems are so popular amongst Ruby developers, and I figured that PHP really needs something similar. So over the Christmas, I have been brewing on a service, which is now stable enough that I'll make it available to the community at large. pearhub.org provides a place where you can register a project, that is hosted on Github, Google code or similar (Currently only git and subversion is supported). The service will generate a PEAR package and put it on a PEAR channel.
PEAR channels have been difficult to set up in the past but the pearhub.org service makes it simple and you get the added benefit of being able to use the PEAR installer application to do installations and upgrades. You can find out more about the service on their FAQ.
voice your opinion now!
pearhub pear channel gem
Hannes Magnusson's Blog: Unix manual pages for PHP functions
by Chris Cornutt January 05, 2010 @ 11:06:06
Hannes Magnusson has a new post today about an interesting feature of the PHP documentation some might not have known existed - manual pages (man) for PHP functions/methods for unix systems.
For a while I had vim configured to run reflection when I hit "K", but after the PHP documentation team released unix manual pages for PHP I now get the manual page in all its glory; function description, parameter descriptions, return values, examples, notes, see also and everything you are used to see from the online manual. Its awesome.
These manual pages aren't installed by default, so you'll have to grab the download from the PEAR channel for the PHP documentation (doc.php.net/pman). If you're wanting to use it in VIM, you'll also need to change the keywordprg setting to "pman".
voice your opinion now!
unix manual page pear vim
Zend Developer Zone: Paging and Sorting Data with Zend Framework, Doctrine and PEAR (part 2)
by Chris Cornutt January 04, 2010 @ 11:52:33
The Zend Developer Zone has posted the second part of their look at pagination with the combination of the Zend Framework, Doctrine and PEAR and how the Zend_Paginator component compares to the PEAR and Doctrine alternatives.
In the previous segment of this article, I introduced you to the Zend_Paginator class, which provides a flexible API for paginating any data collection, whether it is expressed as an array or a database result set. [...] This article will explore two such alternatives, the PEAR Pager class and the Doctrine Pager class, and give you a crash course in how you can use them to quickly add paging and sorting features to your PHP application.
The article gives examples for both of the other methods - a simple pagination of database information with the PEAR pager component (and other packages that can make the results more effective) and the creation of a Doctrine instance where the results are handled via a series of built-in method calls.
voice your opinion now!
tutorial zendframework pear doctrine pagination sort
Zend Developer Zone: Object-relational mapping with Doctrine, Flash Builder, and PHP
by Chris Cornutt December 22, 2009 @ 09:53:16
On the Zend Developer Zone there's a new tutorial on how to use the combination of Doctrine and more PHP to connect with Flash Builder to create a simple classified ad system.
This article shows how to set up Doctrine and use it in PHP code. Then, it exposes PHP services to Adobe Flash Platform applications using Zend_Amf. You'll then call the Doctrine-enabled services from a Flex client. Finally, I'll show you how to switch your database from MySQL to SQLite with four lines of code. And I won't write a single SQL statement.
He shows how to set up a full Apache/MySQL/PHP installation with Doctrine, Flash Builder Alpha and the latest edition of the Zend Framework. He shows how to set up the models, connect Flash Builder to the app via the Zend_Amf component and how to build the frontend for the app inside Flash Builder.
voice your opinion now!
orm doctrine flashbuilder tutorial classifieds
Benjamin Eberlei's Blog: Trying a Two Step PEAR/PHAR approach to develop and deploy
by Chris Cornutt December 21, 2009 @ 14:55:12
Benjamin Eberlei has a new post today about a deployment technique he's trying out - using PEAR and PHAR to create deployable packages.
With PHP 5.3 the PHAR extension is a pretty powerful concept for all your deployment needs, however it does not tell the complete story. [...] With Pirum being a simple PEAR channel server there is also momentum for projects to distribute their code via PEAR. However PEAR is mostly used in the server-wide configuration use-case, which is not very useful if you plan to distribute your complete application in one PHAR file.
He shows how to create a sample package from a Zend Framework application, set it up in a PEAR channel complete with the ability to run a "pear upgrade" to get the latest version of the package. He also includes a bit of sample code to work with the PHAR archive and load the libraries inside.
voice your opinion now!
pear phar deploy develop tutorial
PHPBuilder.com: Build an MVC Framework with PHP
by Chris Cornutt December 18, 2009 @ 07:50:52
On PHPBuilder.com today there's a new tutorial that walks you through the process of creating a simple MVC framework in PHP based on Smarty, PostgreSQL and the PEAR XML_Serializer package.
PHP now enables you to build robust, manageable, and beautiful enterprise web applications. The best way to do that is to divide the application into three components: model, view, and controller. In other words, you need to separate the presentation, the database, and the business logic from each other. The most common approach for achieving this design goal is to adhere to a strict Model-View-Controller (MVC) framework.
He uses the example of creating an application (a feed reader) to show how the parts of the MVC will fit together as a whole. You won't find any code examples in the article, just an explanation of how everything works together. You can, however, dowload the source and follow along.
voice your opinion now!
mvc framework tutorial smarty postgresql pear
Zend Developer Zone: Paging and Sorting Data with Zend Framework, Doctrine and PEAR (part 1)
by Chris Cornutt December 11, 2009 @ 09:43:29
On the Zend Developer Zone there's the first part of a series looking at pagination and sorting of data with the combination of the Zend Framework, Doctrine and PEAR.
When building database-backed applications, one of the important problems for a developer or user interface engineer involves making large data sets more manageable by, and therefore more useful to, application users. [...] Back in the good old days, adding pagination to a PHP application was mostly a manual task, involving offset calculations and custom query generation. In recent years, the task has become significantly simpler, mostly due to the presence of ready-made pagination components in most common frameworks.
His tutorial uses the Zend Framework, Doctrine and the Pager, MDB2 and Structures_Datagrid PEAR packages. He starts with a basic select and format kind of example to show a few lines per page. To improve it (for larger data sets) he shows how to use the Zend_Paginator to only grab the rows needed for the page. Finally, he adds in code to allow for column sorting, making it easy to reorganize the results how you'd like.
voice your opinion now!
zendframework pagination sorting doctrine pear tutorial
Symfony Blog: Doctrine vs Propel
by Chris Cornutt December 07, 2009 @ 14:42:43
Since the Symfony framework project has such tight integration with both the Propel and Doctrine ORM layers, they thought they'd share some statistics on the usage of both as mapped through the stats from their Jobeet tutorial.
As for any Open-Source community, it's not easy to find metrics that tell you what people use and how they use it. You can measure the number of tickets for a specific feature, count the number of people asking for help on Propel or Doctrine. But for the Propel vs Doctrine question, we have two more reliable metrics.
As is shown in this graph of the total Jobeet traffic in 2009, Doctrine is winning by a long shot. That's not to say that you can't still use Propel is that's what you and your application are using, this is just showing the overall popularity of each of the ORMs.
voice your opinion now!
doctrine propel usage statistics
WebReference.com: Globalize your Web Applications PHP's Locale Package
by Chris Cornutt December 07, 2009 @ 12:06:38
On WebReference.com there's a recent article looking at the PEAR internationalization (i18n) packages and how they can be used to internationalize your application.
For many of us, the realization of the extent of countries' interdependence was driven home by the recent global economic meltdown. So what does all this have to do with us Web developers? It's a resounding wake up call that we have to think of other nationalities when we develop our websites and applications. In most cases, developing a web app in English alienates much of the world's population and greatly reduces potential profits! With that in mind, this article is the kickoff for a series that discusses the ramifications of globalization on our websites and applications.
The look at some of the local identifiers (like LC_ALL, LC_TIME, LC_ADDRESS and LANG), how to access the values for them on the different OSes and how to use the I18N_Country and I18N_Language packages from the PEAR I18N package to handle some simple multi-language support.
voice your opinion now!
locale package golablize pear tutorial
Juozas Kaziukenas' Blog: Zend Framework and Doctrine. Part 3
by Chris Cornutt December 03, 2009 @ 10:54:23
Juozas Kaziukenas has posted the third part of his series looking at the powerful combination of Zend Framework and the Doctrine ORM layer.
During last two months I spent massive amount of time tweaking Doctrine ORM framework and making it to perform as fast as possible (as you might have noticed from my never ending tweets). This post is devoted to performance and efficiency, with practical tips & tricks how to reduce memory usage, make it work faster and save resources.
He's broken it up into two main parts with points underneath:
- Speed including a look at hydrators, DQL and optimization
- Memory usage and how you can optimize things that seem simple and some recommendations of tools you can use to resolve some of the trouble spots.
voice your opinion now!
zendframework doctrine memory speed
Fabien Potencier's Blog: Pirum, the Simple PEAR Channel Server Manager
by Chris Cornutt November 30, 2009 @ 08:17:16
Fabien Potencier has written up a post detailing a PEAR channel server manager he's developed, Pirum.
Pirum lets you setup PEAR channel servers in a matter of minutes. Pirum is best suited when you want to create small PEAR channels for a few packages written by a few developers. Pirum consists of just one file, a command line tool, written in PHP. There is no external dependencies, no not need for a database, no need to setup credentials, and nothing need to be installed or configured.
All you need to do to get the tool is download the pirum file and go. It includes features like per-channel HTML pages and Atmos feed release tracking along with several other standard PEAR channel features.
There's already been one project that's made the swtich - PHP_Depend.
voice your opinion now!
pirum pear channel server simple
Adam Jensen's Blog: Using Zend_Acl with Doctrine record listeners
by Chris Cornutt November 25, 2009 @ 11:53:29
Adam Jensen has written up a quick tutorial about using Doctrine record listeners to link a Zend_Acl component with your database.
In previous Zend Framework apps I've written, I often handled access control at the level of the controller action. Each action was represented in the ACL as a resource, and the ACL logic was applied by a custom plugin just prior to any action dispatch. [...] As a result of these concerns, I decided on a lower-level, model-centric approach for this blog: my models are my resources. Each model class implements Zend_Acl_Resource_Interface, and the ACL specifies "create," "read," "update" and "destroy" privileges for each class (more or less).
Checking for the permissions with a setup like this can be time consuming, though, so he found an ally in the record listeners Doctrine allows you to set. He combines a Doctrine_Record_Listener object with a Zend_Acl one in a preInsert method with a getCurrentRole to add the user handling all in one place.
voice your opinion now!
record listener doctrine zendacl zendframework
Juozas Kaziukenas' Blog: Zend Framework and Doctrine. Part 2
by Chris Cornutt November 18, 2009 @ 07:58:25
Juozas Kaziukenas has posted the second part of his series looking at the combination of the Zend Framework and Doctrine (part one is here). In the previous part he explained the technologies some. In this second part of the series he focuses more in getting Doctrine set up and working.
Today we start actual development with Doctrine and Zend Framework. Base of this post is my code which I have been using for quite a few projects and it worked really well.
He walks you through the steps to getting Doctrine set up - creating the database, downloading and unpacking the latest version of Doctrine, setting up your application.ini file and creating the models from the database. Add in a sample query and things should be working perfectly.
voice your opinion now!
zendframework doctrine tutorial install
Juozas Kaziukenas' Blog: Zend Framework and Doctrine. Part 1
by Chris Cornutt November 17, 2009 @ 08:19:18
Juozas Kaziukenas has started a new series of posts to his blog today with this first part of his look at combining the Doctrine ORM with Zend Framework applications.
It was quite common to use Zend_Db_Table as base models class, but it was simply not practical. When you start dealing with relations and hierarchical data types it starts to get really tricky, because simply Zend_Db_Table doesn't provide an extensive enough functionality. So half a year ago Zend Framework developers started to look for better solutions.
An alternative (and a very powerful one at that) was found in Doctrine - an object relational mapper tool that sits on a database layer. Doctrine 2 will even be the first ORM with seamless integration between the Zend Framework (and Symfony). He briefly touches on what some sample code might look like and the command to build out your model classes from predefined YAML files.
voice your opinion now!
zendframework doctrine tutorial
Sameer Borate's Blog: Easy manipulation of URLs
by Chris Cornutt November 10, 2009 @ 12:48:49
On his codediesel.com blog today Sameer Borate has a quick post looking at URL manipulation with the help of the Net_URL2 PEAR package.
Whether you are dynamically creating urls or changing existing ones, manipulation of urls is a frequent coding requirement during development; doing the same on short urls is easy, but quickly becomes complex for urls which have larger query parameters.
He shows how to use the package to parse the current URL into its respective parts (host, port, path, etc) and how to automatically change certain parameters in the current URL and push the updated version back out the other side. There's also a bit there at the end on normalizing URLs.
voice your opinion now!
url manipulation pear neturl2 package
Daniel Cousineau's Blog: Doctrine Migrations Proper
by Chris Cornutt October 21, 2009 @ 09:57:11
Daniel Cousineau has posted a quick guide to migrating database information with Doctrine:
I was talking with someone [...] here at ZendCon and discovered that they were having trouble with migrations in Doctrine. Having gone through the same issues of Doctrine seemingly not being able to figure out your changes and generate migration classes, I thought I'd post the solution here for future reference.
It's four quick steps that'll get Doctrine to automatically generate the differences (deltas) and upgrade your models to reflect these changes.
voice your opinion now!
doctrine migration tip yaml
Symfony Blog: Symfony and Doctrine 2
by Chris Cornutt October 12, 2009 @ 11:49:01
On the Symfony blog there's a recent post showing how to integrate the framework with Doctrine 2 via the sfDoctrinePlugin:
Today I am happy to tell you that this version of sfDoctrinePlugin is now available and ready for you to use. This article will give you a little information about how you can get started using it today!
Installing and enabling the plugin is as easy as a svn checkout and changing a few settings in your project's configuration files. You can then define your database connection and schema information settings so that the rebuild ("symfony doctrine:build") will build out correctly. They include a simple example, a repository class, to let you be sure everything is up and working correctly. You can find more information about Doctrine 2 from its online manual.
voice your opinion now!
symfony framework doctrine tutorial
IBuildings techPortal: Using PHP_CodeSniffer
by Chris Cornutt October 12, 2009 @ 07:58:51
On the IBuildings techPortal site today there's a new article from Lorna Mitchell about the use of the PHP_CodeSniffer PEAR package to run formatting checks on your code.
PHP Code Sniffer (PHPCS) is a package for syntax checking, available from PEAR. It can check code against defined rules covering anything from whitespace through doc comments to variable naming conventions and beyond. In this article we'll look at getting started with PHPCS, using it to syntax check our files, and go further to look at how the rules are create and the standards defined.
She goes through the installation (a simple call with the pear installer) and a few examples of code and the matching output for a few of the syntax formats included with the tool. She also has a section on the structure of some of the rules and looks at the sniff for defining functions for the PEAR standard.
voice your opinion now!
pear phpcodesniffer tutorial syntax
Sameer Borate's Blog: Detecting user agents in PHP
by Chris Cornutt October 07, 2009 @ 08:21:22
In a new post to his blog today Sameer looks at a trick or two about detecting the type of browser/client a visitor is using to view your website - one method with the superglobal and another with a helpful PEAR package.
Every time you use your browser to access a website a User-Agent header is sent to the respective server. Detecting user agents on the server can be useful for many reasons: browser quirks, personalize content, preventing illegal access.
He talks about the get_browser function that's included in PHP but that requires a browscap.ini file to work. His other option is the Net_UserAgent_Detect PEAR package. It grabs the user agent and breaks it up into the browser type, operating system information and any Javascript-related headers that come along with it. There's also useful tests like "isIE()" and "isNetscape()" built into the package.
voice your opinion now!
detecting user agent pear
Till's Blog: A case for PEAR and PHP4 (Or, why BC is important!)
by Chris Cornutt September 23, 2009 @ 11:11:34
In this new post to his blog till argues his case for PEAR and why support for PHP4 is a good thing when it comes to making things "just work."
Every once in someone likes to argue that PEAR is all fugly PHP4 code and why you should not use it, and instead go and use another framework or component library. Most of those people also say that they looked at or used PEAR x years ago and then act all surprised when someone else disagrees.
He talks about some of the rules around the major/minor PEAR releases and backwards compatibility breaks which, thankfully, a lot of other projects seem to adhere to. He points out that some packages have been started for different PHP generations (Mail_Queue2 vs Mail_Queue) and a few reasons why the PHP4 EON doesn't automatically mean PEAR should follow suit.
voice your opinion now!
pear backwards compatibility php4
Brandon Savage's Blog: The Slow Death of PHP 4
by Chris Cornutt September 18, 2009 @ 10:35:03
In a new post to his blog today, Brandon Savage talks about the "fade time" for PHP4 and how, really, it's gone on long enough.
Sadly, developing for PHP 4 backwards compatibility is something that companies and individuals are still doing. Wordpress released a new Widget API in version 2.8 that relies on the old-style PHP 4 constructor. Apparently, for Wordpress and many other developers, wide adoption is more important than language improvements.
This all came about because he noticed the Log PEAR package still supported PHP4. He's been making updates, though, to bring it out of the shadows and into the light of PHP5-only support.
Still, I look forward to the day when PHP 4 finally does go away forever, leaving us with a much better code base and happier developers.
voice your opinion now!
death php4 pear
Sudheer Satyanarayana's Blog: XML RPC Client Using PHP PEAR - A Real World Example Ping Technorati
by Chris Cornutt September 07, 2009 @ 16:45:04
Sudheer Satyanarayana has this new post on his blog today talking about a simple way (via a PEAR package) to make an XML-RPC connection to ping technorati about updates to your blog.
In a previous blog post we discussed how to consume the Technorati ping web service using XML-RPC. The PEAR package XML_RPC2 provides convenient client and server objects. You can call the remote methods as if they were the methods of the client object. In this post, let us accomplish the same using a PEAR package XML_RPC2. We will write a client script to update Technorati when there is new post in your blog site.
You'll need to grab the XML_RPC2 PEAR package to make this all work, but once that's installed, you're a quick few lines of code away from a client to update Technorati with the ping information for your site.
voice your opinion now!
xmlrpc client pear tutorial
Sameer Borate's Blog: Using barcodes in your web application
by Chris Cornutt September 07, 2009 @ 15:06:50
On his Code Diesel blog Sameer takes a look at creating and using barcodes in your PHP applications:
Brought into the mainstream by supermarket checkout systems, bar codes have become a ubiquitous element in our daily lives. Rarely will one come across any product that doesn't have a barcode. The idea of a barcode originated in 1932 from the thesis of Wallace Flint at Harvard.
He touches on a two types of barcodes - standard UPC and the matrix codes (like ShotCode and Semacode) - before looking at how you can create them with the PEAR Image_Barcode package. It supports multiple code types including Code 39, EAN 13, INT 25 and PostNet. Output examples are included.
voice your opinion now!
barcode pear imagebarcode tutorial
Symfony Blog: Subversion mirrors for Phing, Propel, and Doctrine
by Chris Cornutt August 28, 2009 @ 11:38:32
Following some issues with the Phing and Propel subversion repositories for Symfony, Fabien Potencier has made a few changes to aid in their future stability.
The Phing and Propel Subversion repositories have suffered from long downtime periods quite often recently (last one was today). It is quite annoying as when it happens, you cannot easily update your symfony repositories, let alone the checkout of a symfony branch. To make things worse, the Doctrine repository also had some problems recently. A lot of symfony users are quite upset by the situation, myself being the first one.
The solution - create some mirrors to provide more than one source to fetch the latest checkouts from. Here's the list of the new resources: Phing mirror, Propel mirror, Doctrine mirror.
voice your opinion now!
subversion mirror propel phing doctrine
PEAR Blog: Fixing "unsupported protocol"
by Chris Cornutt August 28, 2009 @ 07:55:49
If you've had issues with an "unsupported protocol" message when working with the PEAR installation on your PHP instance, you should check out this quick post from the PEAR blog with a tip on how to fix it.
When trying to install something, you will get the error: pear.php.net is using a unsupported protocal '" This should never happen. install failed. This problem comes from corrupted channel files. Go into your PEAR php directory and backup .channels directory.
If you go into your PEAR installation and move the .channels directory out of the way then run an "update-channels" the issue should be corrected. Unfortunately, this also means you loose all channels you'd subscribed to, but does save you from having to reinstall PEAR completely.
voice your opinion now!
pear unsupported protocol error
Pablo Viquez's Blog: Export Excel Spreadsheets using Zend Framework
by Chris Cornutt August 25, 2009 @ 07:57:30
New on his blog today Pablo Viquez has this post looking at code that will let your Zend Framework applications export to Microsoft Excel spreadsheets (via the Spreadsheet Excel Writer PEAR component).
Last week, I had to allow the user to export a given report into an MS Excel file format. The application uses Zend Framework 1.9.1 and so far ZF does not support for "Office" formats, so after searching for a nice implementation, I found a PEAR module called Spreadsheet Excel Writter, which looked pretty good, it had very good documentation and the code was clean and well structured so I wanted I give it a shot.
He lays out the structure of the sample application and, using a context switch on the request, he creates a controller that responds to the "/report" by calling a special model/view combination that uses the PEAR package to push out the custom "report.xls" file.
voice your opinion now!
zendframework pear excel spreadsheet
Matthew Weier O'Phinney's Blog: Autoloading Doctrine and Doctrine entities from Zend Framework
by Chris Cornutt August 21, 2009 @ 08:47:35
Matthew Weier O'Phinney has a new post on something he's been asked about a lot - autoloading Doctrine into a Zend Framework application.
A number of people on the mailing list and twitter recently have asked how to autoload Doctrine using Zend Framework's autoloader, as well as how to autoload Doctrine models you've created. Having done a few projects using Doctrine recently, I can actually give an answer.
His short answer - "attach it to the Zend_Loader_Autoloader". For those needing the long answer, he goes through a simple example of creating the loader object, registering a new namespace and pushing in the Doctrine functionality as an autoloader. The bootstrap class can then be modified with an "_initDoctrine" method to pull in just what scripts your app might need.
voice your opinion now!
autoload doctrine zendframework orm
PEAR Blog: The new Group has been elected!
by Chris Cornutt August 11, 2009 @ 07:51:10
According to this new post on the PEAR blog, the new PEAR Group has been officially elected:
I am more than glad to announce the arrival, the announcement of the new PEAR Group for 2009 and 2010. With a few fresh faces in the Group, this year looks very promising with the mix of both new blood and experienced PEAR Group members.
Those selected include Chuck Burgess, Ken Guest, Christian Weiske and Brett Bieber. The PEAR Group helps to guide the PEAR project as a while and push out initiatives like the updated package manager - Pyrus.
voice your opinion now!
election result pear group
Giorgio Sironi's Blog: Doctrine 2 now has lazy loading
by Chris Cornutt August 07, 2009 @ 11:07:37
As is mentioned in this new post to Giorgio Sironi's blog, the latest version of Doctrine now includes lazy loading functionality.
Lazy loading is the capability of performing a expensive operation on demand, only when it reveals necessary from a client request. [...] In Doctrine 2 I made some architectural choices implementing the proxy approach, which substitute a subclassing object to every association which is not eager-loaded.
There's two main places you can see these differences - in the one/many to one associations dynamic proxies and collection interface.
voice your opinion now!
doctrine lazy load relationships
IBM developerWorks: MVC with Agavi - Add forms and database support with Agavi and Doctrine
by Chris Cornutt July 28, 2009 @ 07:51:01
The second part of the IBM developerWorks series looking at the Agavi PHP framework has been posted. In it Vikram Vaswani loks at adding forms and database support to his example via Doctrine.
While Agavi can certainly be used to serve up static content, it really shines when you use it for something more complex. And in this second part, you'll do just that - over the next few pages, you'll learn how to receive, validate, and process input from Web forms, as well as connect your Agavi application to a MySQL database.
He returns to his simple templated example site and shows how to use the command line agavi tool to create the routing and controller to handle the "contact us" requests. He includes form validation examples, how to use the population filter, and how to generate the Doctrine models to connect with the form directly.
voice your opinion now!
agavi form database doctrine tutorial
PEAR Blog: Setting Up PEAR2 and PEAR Checkouts With SVN 1.5+
by Chris Cornutt July 27, 2009 @ 11:15:12
The PEAR blog has posted some handy instructions for those out there that want to get PEAR and PEAR2 checkouts working from the new Subversion repository (recently moved from CVS).
Now that pear2 is in svn.php.net, it is possible to do commits with
multiple packages using a feature of subversion called "sparse checkouts." [...] Here is the version I used to set up pear and pear2 in a way that will allow committing to both pear and pear2 packages in a single commit.
Rasmus Lerdorf has written about the same thing for the main PHP side of things. All the commands you'll need are there to get things set up and working more efficiently.
voice your opinion now!
subversion svn pear pear2
Cal Evans' Blog: XAMPP, PHP 5.3, PEAR, and PHAR (what a mess)
by Chris Cornutt July 13, 2009 @ 10:53:18
Cal Evans had an issue - it involved XAMPP, PHP 5.3, PEAR and phar:
If you are installing PHP 5.3 and when you run go-pear.bat you get this: phar "C:xamppphpPEARgo-pear.phar" does not have a signature.
The short method to getting it working correctly is to update your php.ini file with a few small changes to the require_hash setting. Cal goes through the long method he took to finally get to that point - decision on the platform (XAMPP), version of PHP to use and some googling around that lead him to this and this to help resolve his problem.
It turns out that, if that's on, for security purposes it can't be overridden. Since the default is on, I had to open up my php.ini, find it and set it to off. Once it's off, everything works just fine.
voice your opinion now!
requirehash phar pear xampp
Zend Developer Zone: Accepting Credit Card Payments with OXID eShop CE and Authorize.Net
by Chris Cornutt June 26, 2009 @ 16:48:14
The Zend Developer Zone has a new post from Vikram Vaswani about accepting credit card payments through Authorize.net in the OXID eShop CE (e-commerce platform).
Now, if you're planning to start an online store, it should be pretty clear that accepting electronic payments isn't an option - it's a necessity for you to compete effectively. And that's where this article comes in. Over the next couple of pages, I'll show you how to begin accepting credit card payments for your products using the open source OXID shopping cart and the Authorize.Net payment gateway...with, of course, a little bit of PHP to make things interesting!
The glue between the OXID install and Authorize.net is created with the PEAR HTTP_Request2 package. This combined with a little extra PHP code can be installed and used as a component directly inside the application. He gives full code and screenshots to help you get it up and running on your install.
voice your opinion now!
httprequest2 pear oxidshop authorizenet
The PEAR Blog: pear.php.net moving on
by Chris Cornutt June 16, 2009 @ 07:53:18
As is mentioned on the PEAR blog today, there's some new advancements that are being made to make submitting proposals simpler.
Thanks to the efforts of Daniel O'Connor, the PEAR website is getting nicer and better. Bug RSS feeds support Baetle now, the PEAR proposal system - PEPr - works again and many small improvements and fixes found their way on the site.
Baetle is a "bug and enhancement tracking language" project that describes the information in things like the BugZilla and Jira tracking applications.
voice your opinion now!
pepr proposal baetle pear
Community News: Want to Work on Doctrine?
by Chris Cornutt May 25, 2009 @ 13:45:31
Feel like getting involved with a PHP-based Open Source project, but don't know where to start you might consider getting involved with the Doctrine project - they're currently looking for a few good programmers.
Many of you probably know Jonathan, Guilherme and Roman as being the core developers of the Doctrine project over the past 2 years. While this constancy is a good thing it's also problematic. [...] So we are left wondering. What can we do differently to get more people involved? Given the amount of users and noise about Doctrine around the PHP scene, we find the absence of new contributors quite strange
The Doctrine project is looking for developers (on both the 1.x and 2.x release series) to either get involved of to help them out with suggestions on how to get others interested in working with the project. To get in contact with the team, you can just send an email to any one of the three: jonwage [at] gmail [dot] com (Jonathan), r.borschel [at] gmx [dot] net (Roman) or guilhermeblanco [at] gmail [dot] com (Guilherme).
voice your opinion now!
interest opensource doctrine
Jani Hartikainen's Blog: Doctrine vs. Propel 2009 update
by Chris Cornutt May 19, 2009 @ 11:55:40
Jani Hartikainen takes a look at two of the major PHP ORM libraries in this new post - Propel and Doctrine.
The best PHP ORM libraries, Doctrine and Propel. Last year I compared them to each other, and now it's time to get a fresh look at how they have advanced in about a year - Is Doctrine still the better of the two? This time, I'll also look at the features of each in more depth.
He goes through some of the features (basic and advanced), how easy they are to use and their connections to the database. His personal preference? Doctrine works better for his needs.
voice your opinion now!
orm compare propel doctrine
Zend Developer Zone: Adding Multi-Language Support to Web Applications with PHP and PEAR
by Chris Cornutt April 24, 2009 @ 14:48:15
On the Zend Developer Zone today a new tutorial has been posted about multi-language translation for your site with PHP and the Translation2 PEAR package.
If you're using PHP, adding multi-language support to a Web application is quite easy, especially since the PHP Extension and Application Repository (PEAR) includes some ready-made code to help you get started. And that's where this article comes in. Over the next few pages, I'll introduce you to PEAR's Translation2 package, and show you how you can use it to add multi-language support to your application.
You'll need to have everything up and running (including an install of the PEAR package) before getting started. The tutorial shows how to set up database tables and sample data to reference with a basic "Hello World" script as well as a few more complex examples involving user input and creating a cross-language menu for a sample site.
voice your opinion now!
pear tutorial translation2 package language switch
Zend Developer Zone: Using the Twitter API with PHP and PEAR
by Chris Cornutt April 15, 2009 @ 09:31:39
On the Zend Developer Zone a new article has been posted (by Vikram Vaswani) about how you can use the Services_Twitter PEAR package to connect your applications with Twitter.
Unless you've been living in a cave for the last few years, you know what Twitter is - a free online service that allows users to send out concise, real-time updates on what they're doing at any given moment.
[...] The really good stuff, though, is hidden behind the scenes. Like many Web 2.0 applications, Twitter exposes its innards to the public via a REST API, making it possible to develop customized applications that run on top of the base service. [...] This article focuses on one such library, the PEAR Services_Twitter library, which provides a full-featured API for interacting with the Twitter service through a PHP application.
Once the package is fetched (via the "pear" command on the command line) he shows how to make some example connections like grabbing the most recent status for a user, updating that status, grabbing recent posts from a user's timeline, finding followers/friends and much more. The package makes it so simple that any one of these examples isn't much more that seven or eight lines long.
voice your opinion now!
twitter api pear package service tutorial
Sameer Borate's Blog: Detecting duplicate code in PHP files
by Chris Cornutt April 08, 2009 @ 11:16:17
On his blog today Sameer looks at a method for finding duplicate code in your applications with the help of PHPCPD.
Duplicated code in projects is a frequent thing and also the one ripe for factoring out in a new class or function. Cut/Paste coding is a common development practice among programmers, a lot of which can lead to code size increase and maintenance nightmares. PHPCPD (php copy paste detector) is a PEAR tool that makes it easier to detect duplicate code in php projects. Below is a short tutorial on the PHPCPD package.
You can either install the tool via a PEAR channel or directly from the github site. Once its downloaded and extracted you can immediately run it on the subdirectory of your choice. He also includes a more extended example - a search on a minimum of 5 lines of 70 tokens found to trip the filter in finding cloned functionality.
voice your opinion now!
phpcpd pear channel install tutorial copy paste detector
Christoph Dorn's Blog: FirePHP for Zend Server
by Chris Cornutt April 01, 2009 @ 10:21:08
Zend recently released one of their latest offerings to the PHP development community - Zend Server. Using the Community Edition of the platform, Christoph Dorn has integrated a popular debugging tool - FirePHP - into his local installation.
This PHP environment bundle is backed by Zend which means it will stay maintained and likely make it into many corporate environments. It also ships with Zend Framework and PEAR which means it has full native FirePHP support right from the start! [...] I am going to walk you through how you can get FirePHP setup for ZendServer with the help of some glue code. The glue is available from the FirePHP PEAR channel and will be maintained along with FirePHP going forward.
Before getting into the installation/configuration of FirePHP, he stops to talk a bit about PEAR and what it can do for you and your applications (and a few places it could improve). Following that, he gets to the good stuff and walks through the install of Zend Server, including the FirePHP PEAR package and doing a little debugging to ensure you're set up correctly.
voice your opinion now!
firephp zendserver zend pear package debug
Blue Parabola Blog: Coding Standard Analysis using PHP_CodeSniffer
by Chris Cornutt March 17, 2009 @ 07:57:47
Over on the Blue Parabola blog Matthew Turland recently posted a new tutorial on using the PHP_CodeSniffer PEAR package to check out how well your code adheres to the coding standard of your choice.
For the sake of consistency [on a client project], the development team had stuff with the coding standard used by the framework itself. However, evaluating the code manually is tedious and time-consuming. There's a solution to this type of problem: the PHP_CodeSniffer package from PEAR, which builds an infrastructure around tokenizers for PHP, CSS, and JavaScript and utilities to detect coding standard violations within code in any of those languages.
He includes an example token output (the codesniffer package is based on the Tokenizer) from a script and walks you through the initial setup of the package, how to create "sniffs" for the code you want to analyze and how to run them using the popular unit testing tool PHPUnit.
voice your opinion now!
phpcodesniffer sniff coding standard kohana analyze pear phpunit
Kevin van Zonneveld's Blog: 7 Steps to better PEAR documentation
by Chris Cornutt February 23, 2009 @ 11:11:55
Kevin van Zonneveld has posted seven steps that you can follow to help the documentation for your PEAR class come out better and be more useful in the end.
If you've written a PEAR package, it's probably a good idea to submit some end user documentation. Here's how to do it.
He explains what it is (XML in CVS, easily convertible with phpd) and how the process flows - save the current docs, add your own, build locally and submit to CVS. Here's his tips to help things go smoothly/turn out better:
- Gather the prerequisites
- Save current documentation
- Try building the docs
- Write your own XML docs
- ReBuild peardoc
- Commit your XML
- (There is no seventh step - you're done!)
voice your opinion now!
better pear documentation steps xml cvs phpd build submit package
Greg Beaver's Blog: Pyrus, PEAR2 and web code coverage report for phpt-based tests
by Chris Cornutt February 17, 2009 @ 09:31:57
Greg Beaver has posted an update one some of the things he's been working on in the realm of his projects - Pyrus, PEAR2 and code coverage for phpt-based tests.
In any case, now that work on ext/phar has shifted primarily to maintenance mode, and namespaces are finally ancient history, I've shifted all of my coding energy to getting Pyrus, PEAR's next-generation installer, ready to ship.
Pyrus is the PEAR installer as rewritten for the next major PHP release (5.3) and uses a lot of the new features it offers (including full archive support, SQLite 3, combined configuration files and several new developer-centric additions). He also includes a sample bit of code that he worked up to run code coverage reports against the PEAR packages. He includes links to three different examples of the report's output.
voice your opinion now!
pyrus pear codecoverage unittest phpt test installer pear2
Chuck Burgess' Blog: Configuring Builds for PEAR Packages in phpUnderControl
by Chris Cornutt February 09, 2009 @ 12:06:01
Chuck Burgess has posted a guide for developers out there wanting to get their PEAR packages working with phpUnderControl for builds.
there were some things that I had to discover via trial-and-error with regard to the build files, though possibly they are covered in other pUC docs that I didn't check. The "Getting Started" build example is based on a project sandbox pulling code from a Subversion repository, whereas all my PEAR code comes from CVS.
He talks about his config.xml file (how it turned out that the basic one was all he really needed) and configuring the build.xml to run the tests from the correct location. He also mentions some future ideas like making the builds run the install/upgrade commands before running the tests.
voice your opinion now!
phpundercontrol pear package subversion cvs configxml buildxml
Zend Developer Zone: Building AutoComplete Inputs with PHP, PEAR, Dojo and YUI
by Chris Cornutt February 04, 2009 @ 15:29:25
The Zend Developer Zone has a new tutorial posted (from Vikram Vaswani) about adding in an auto-complete input field to your site. His example uses a PEAR class, Dojo and some components of the YUI libraries.
Fortunately, modern programming toolkits like Dojo provide ready-made widgets that have the necessary client-side functions for autocomplete. Add a little bit of server-side glue, in the form of a PHP script that talks to a database to generate valid suggestions, and enabling this functionality in a Web application now becomes a matter of hours, rather than days. In this article, I'll show you how to do this using three different libraries: PEAR HTML_QuickForm, YUI, and Dojo. Come on in, and find out more!
He shows how to combine Dojo, YUI and the HTML_QuickForm PEAR package to create a field that, based on what they enter into the input field, searches a database to find values in that table.
voice your opinion now!
autocomplete input field tutorial yui dojo pear htmlquickform
Zend Developer Zone: Building AJAX Applications with PHP and HTML_AJAX
by Chris Cornutt January 27, 2009 @ 11:19:28
In a recent post to the Zend Developer Zone Vikram Vaswani takes a look at using AJAX quickly and easily in your applications with the help of the HTML_AJAX PEAR package.
Well, PHP is commonly used on the server end of the connection, to handle AJAX requests and send back responses. But that isn't all it can do - with a little PEAR package called HTML_AJAX, you can use PHP to significantly simplify the work that goes into building and deploying an AJAX application. That's where this article comes in. Over the next few pages, I'm going to give you a quick run-down on the PEAR HTML_AJAX class, together with a few examples of how you can use it to AJAX-ify various Web applications.
He goes through the whole process - installing the package and five example scripts to show it in action:
- Pulling from a simple database table of book and author information
- Calculating simple interest
- Creating a simple calendar
- Evaluating an inputted number
- Simple login validation
voice your opinion now!
ajax application htmlajax pear package tutorial
Jani Hartikainen's Blog: Optimizing Zend Framework and Doctrine applications
by Chris Cornutt January 27, 2009 @ 09:30:37
In a quick post Jani Hartikainen take a look at some optimization tricks you can do to help get the most out of your Zend Framework/Doctrine application.
I decided to try profiling my quiz application to see if I could speed it up. Not surprisingly, biggest performance penalties came from loading classes and Doctrine's ORM magic. [...] As you may have heard, optimizing without profiling first is a bad idea, as you may think something is slow when something completely different would be better to optimize.
some of his suggestions include:
- Removing all require_once calls from the Zend Framework library
- Change the include_once_override setting if you're using APC
- Using the query cache in Doctrine
- Using the Doctrine_Table find functions rather than the Doctrine_Query objects
voice your opinion now!
zendframework optimize profile xdebug doctrine
Symfony Blog: The "Practical symfony" book is now on sale
by Chris Cornutt January 20, 2009 @ 12:07:08
On the Symfony blog today there's a new post from Fabien Potencier about a new book that's just been released and might be of interest to those wanting to get into the framework - Practical Symfony.
Two years after the publishing of "The Definitive Guide to symfony" book, I am happy to announce that the Jobeet tutorial is now available as a printed book: "Practical symfony". During the last two weeks, I have updated and enhanced the Jobeet tutorial based on the feedback from the community. I have also updated the screenshots to reflect the new Jobeet design. The "Practical symfony" book is the printed version of this tutorial and as such covers the symfony 1.2 version.
The Jobeet tutorial was their 2008 "advent" piece that created a job posting website from scratch with each day focusing on a different aspect of the application. There are two versions of the book (Propel and Doctrine) but for now, only the Propel version can be purchased over on lulu.com.
voice your opinion now!
practical symfony framework tutorial book propel doctrine
WebResourcesDepot.com: 19 Promising PHP Template Engines
by Chris Cornutt January 16, 2009 @ 12:08:20
Looking for a good templating engine for your next PHP application? Be sure to check out this great list on the WebResourcesDepot site for a pretty comprehensive list.
PHP template engines are used widely to seperate the code & the layout. PHP makes a website easier to maintain/update & creates a better development environment by enabling developers & designers to work together easier. It sure has some drawbacks which is generally the performance (most libraries offer great solutions there) & need to learn a new syntax (not always).
Some of the engines included in the list are:
voice your opinion now!
template engine list smarty savant pear dwoo
Kevin van Zonneveld's Blog: Create daemons in PHP
by Chris Cornutt January 12, 2009 @ 08:47:31
In a new post to his blog Kevin van Zonneveld talks about making daemons, backend scripts that run independent of a web server.
Everyone knows PHP can be used to create websites. But it can also be used to create desktop applications and commandline tools. And now with a class called System_Daemon, you can even create daemons using nothing but PHP. And did I mention it was easy?
He starts with a definition ("a linux program that runs in the background") and why PHP makes a good language choice for creating them. His example uses the System_Daemon PEAR class to do most of the heavy lifting. To use it, you only need to include it at the top of the script and make two calls to the setOption and start methods to have the rest of the code all set to run as a daemon.
The example code sets up a daemon complete with support for command-line arguments and the ability to be run from init.d on the local system.
voice your opinion now!
tutorial daemon shell script systemdaemon pear package
Ralph Schinder's Blog: The Semi-Official Zend Framework Pear Channel
by Chris Cornutt January 08, 2009 @ 12:57:44
Ralph Schinder has posted about a new development in the world of Zend Framwork distribution - a PEAR channel.
For the past few months, the ZF team has been playing with the idea of releasing ZF from a PEAR channel. Over the past 2 years, we have seen a few channels distributing ZF that have pop up here and there.. so that lead us to believe there is an itch that needs scratching. The compelling reason against a PEAR channel is that, with ZF, there is nothing to "install". Just pop ZF in your include_path and off you go.
With the introduction of the next release (1.8) and the Zend_Tool component that comes with it, the framework is graduating from a "component library" into a more holistic framework with a more advanced distribution system. For those interested, he also includes the details of the channel (from pear.zfcampus.org) and the organizational plan of how the channel is laid out.
voice your opinion now!
pear channel zendframework official component library zendtool install distribute
Jani Hartikainen's Blog: Decoupling models from the database Data Access Object pattern in PHP
by Chris Cornutt January 05, 2009 @ 21:22:26
In this new post to his blog Jani Hartikainen looks at implementing the Data Access Object pattern in your PHP applications.
The advantage of this is that you can easily implement different methods to persist objects without having to rewrite parts of your code. I'm again going to use the programming language quiz game I wrote as an example. Since I initially wrote it to use Doctrine ORM directly, and both the old and new code are available, you can easily see how the code was improved.
He starts off with a look at the pattern itself (including a diagram of how an example would work with Doctrine) followed by the creation of the models for his Questions example. Add in the factory to create an instance and an exmaple of it in action and you're there.
voice your opinion now!
decouple model data access object designpattern tutorial doctrine
Till's Blog: PEAR & Plesk
by Chris Cornutt December 10, 2008 @ 09:34:15
In this new post to till's blog, he looks at a method for setting up PEAR on a Plesk system.
Now running any config interface is a blog entry by itself and when I say Plesk, I should also mention confixx and cpanel. And while I have a strong dislike for all them, let me focus on Plesk for now. This is not a copy'n'paste howto, so make sure you double-check all steps involved. With little knowledge, you should be able to to apply all instructions to any other control panel, all you need is SSH access to the server.
The process includes two different sections - why your PEAR installation may not be working and how to install the PEAR packages (on any system supporting a package manager). Command line calls and configuration options are also included.
voice your opinion now!
pear plesk install troubleshoot package controlpanel ssh
DevShed: Logging in PHP Applications
by Chris Cornutt December 08, 2008 @ 13:52:10
DevShed has posted a new tutorial today looking at one of the more useful tools a developer can add into an application - logging.
If there is no logging mechanism, then if there's a goof-up in a production environment, you have absolutely no idea what went wrong. The only thing which a support developer can do in this case is to reproduce the issue at the developer end, which sometimes work and sometimes don't.
The look at the types of logging (trace logs, audit logs and user logging/history) and create a simple class that allows flexibility for file location, priority and timstamping. Their script contains a writelog method that does all the work (including pushing it through the PEAR logging class).
voice your opinion now!
log tutorial pear trace audit history priority timestamp location
Matthew Turland's Blog: Benchmarking PHP HTTP Clients
by Chris Cornutt November 24, 2008 @ 07:56:30
Matthew Turland has this new blog post looking at some benchmarks he's generated for a group of mainstream PHP HTTP clients:
One of the interesting bits of research that I've done is benchmarking various mainstream PHP HTTP clients. Of course, we all know that there are lies, damned lies, statistics, and benchmarks, so take these with a grain of salt.
He ran them on his Sony Viao on Ubuntu with a stock PHP5 package. The tested packages were the pecl_http extension, the streams http wrapper, curl integration into PHP 5, PEAR::HTTP Client class and the Zend_Http_Client component. He includes the code he used for both a basic request and for something slightly more complex (posting form data). He used the XDebug and KCachegrind combination to produce the results.
voice your opinion now!
benchmark http client pecl pear zendframework streams curl
Symfony Blog: New in symfony 1.2 Doctrine goodies
by Chris Cornutt November 07, 2008 @ 12:33:15
The symfony blog has a new post spotlighting one of the new features of their 1.2 release - updates to its Doctrine functionality.
A lot of awesome stuff has been added recently to the next major symfony release, 1.2. Fabien has worked very hard to add without a doubt the most sophisticated features of any PHP framework that exists today. Not only are they nice features but he has implemented them in a OO way so that it is easy for me to implement the same features with another ORM, Doctrine. All this is done with very little work by me. So, give a big thanks to him if you enjoy this.
Included in the post is a real-world example showing how to use the symfony command line to build out an environment and create connections to the articles, categories and authors tables.
voice your opinion now!
doctrine symfony framework build feature example
Developer.com: Sending Email with PHP
by Chris Cornutt November 05, 2008 @ 07:58:47
On the Developer.com website today, Jason Gilmore has a new tutorial covering a important feature of any based PHP install (unless disabled, of course) that is widely taken advantage of - sending emails.
Email plays a crucial role in website development, whether you'd like to confirm a new registrant's email address, recover a lost password, or provide prospective clients with a convenient means to contact you. [...] In this tutorial, I'll introduce you to several solutions for sending email using PHP, including PHP's native mail() function, PEAR's Mail package, and the Zend Framework.
He starts with some of the fundamentals of mail - the difference between POP3 and SMTP, Sendmail, etc - before moving on to an example of the mail function's usage. He does the same with the PEAR Mail package and the Zend_Mail component of the Zend Framework.
voice your opinion now!
send email mail pear zendmail zendframework tutorial
Sameer's Blog: Simple Pagination in PHP tutorial
by Chris Cornutt October 30, 2008 @ 10:29:02
Sameer has posted a new tutorial to his blog recently, a look at a drop-in solution for pagination in your application - the PEAR Pager package.
Pagination is a frequent requirement in web development projects. Most PHP developers must have already implemented paging in one form or other in their projects. In this post we will see how to add pagination the easy way using PEAR's Pager class. Note that in all the posts I use PHP 5.x.x, so if you are still stuck at version 4.x.x, its already time to upgrade.
He includes a simple example (just the page links), how to install the Pager package and a larger example where the results are pulled from a database table and paginated correctly based on an offset ID. There's even some CSS thrown in to make it a bit more pleasing to the eye.
voice your opinion now!
pagination pear package pager install tutorial css
ProDevTips.com: PHP Doctrine - adding automatic, simple CRUD
by Chris Cornutt October 28, 2008 @ 11:14:27
The ProDevTips site continues their look at using Doctrine in PHP with this latest article in the series that adds in a simple, automatic CRUD system to the application.
I just found myself wishing for automatic CRUD, for quick and simple administrative tasks, as it turned out a very easy thing to add.
They create a model for their Company table and a new controller to handle the admin requests. Throw in some fetching functions, a bit of form handling and a bit of Smarty login and you have a simple admin form that automatically creates itself based on the columns in the table.
voice your opinion now!
doctrine crud simple tutorial controller model smarty
Jani Hartikainen's Blog: ModelForm developments
by Chris Cornutt October 20, 2008 @ 11:19:45
Jani Hartikainen talks about some updates he's made to the ModelForm class for the Zend Framework and how its been reworked a bit to take advantage of Zend_Db_Table.
I've been reworking the ModelForm class for ZF a bit. Earlier this year, I discussed porting it to use Zend_Db_Table with Matthew Weier O'Phinney, for using it with Zend Framework. I initially had done some checking on Zend_Db_Table, and some small code changes to modify the class to use it instead of Doctrine, but I ran into some issues. Now, I've had some time to think about it, I've reworked the class slightly and added basic Zend_Db_Table support, too...
He talks about the two sides - the issues that came up (including relation support and differences between Zend_Db_Table and Doctrine) and how they were overcome (creating an adapter setup to accommodate for the relations issues).
voice your opinion now!
modelform zendframework development relations doctrine
Christian Weiske's Blog: PEARhd steaming on
by Chris Cornutt October 16, 2008 @ 08:49:02
Christian Weiske set out on a project - no small thing - to convert the current PEAR documentation info over to the PhD DocBook rendering system. In a new post he talks about the conversion process and some of the technology involved.
The reason for PhD to exist was that the previously used DSSSL based system was slow: a full build (all formats and all languages) took 24 hours to complete. Further, the tools the system based on were old, rusty and nobody understood why they broke on some machines, but also why they worked on other ones. Having a php-based system for PHP ensures that there is always someone around who can fix it if it's broken. This wasn't the case with the old documentation build system.
The conversion was spurred on by the fact that the PEAR documentation stopped building and more and more people were finding it hard to build on their machines too. He walks through the steps he took - installing PhD, converting over the docs to the DocBook 5 format and the first builds with the new system.
Now that at the XML was shiny, too, it was time to actually use PhD on it. The numbers were amazing: While a build for one format and one language took around 40 minutes on my system (dual core Macbook with 2GHz and 2GiB RAM), building the same with PhD takes 45 seconds!
voice your opinion now!
pear documentation docbook phd render xml xsl
Symfony Blog: Doctrine gains symfony citizenship in 1.2
by Chris Cornutt September 16, 2008 @ 09:48:56
As announced on the symfony blog today, Doctrine now has "citizenship" in the framework with the release of the sfDoctrinePlugin:
Today, Doctrine gained its citizenship in symfony 1.2. The sfDoctrinePlugin was linked via externals and is now officially bundled with symfony. If you've been around for a while, you'll know that this was highly anticipated and is a long time coming. To celebrate, I'll give a short little tutorial on how you can get started using Doctrine in symfony. Read below if you're interested.
The post gives you a brief introduction to how to load and use the Doctrine plugin, including how to build out an application automatically via the symfony binary.
voice your opinion now!
symfony framework doctrine plugin tutorial
Devollo.com: Data Filtering Using PHP's Filter Functions - Part one
by Chris Cornutt September 15, 2008 @ 09:33:33
On Devollo.com the first part of a series looking at something every PHP developer (or any other for that matter) should include in their application - data filtering.
Filtering data. We all have to do it. Most, if not all of us, despise doing it. However, unbeknown to most are PHP's filter_* functions, that allow us to do all sorts of filtering and validation. Using PHP's filter_* functions, we can validate and sanitize data types, URLs, e-mail addresses, IP addresses, strip bad characters, and more, all with relative ease. This is part one of two, covering filter_var() and the different constants and flags that can be set.
This method, using the filter extension, takes a lot of the work out of making sure that user-submitted data is what it should be. They include examples of how to filter numeric types, URLs, email addresses and how to sanitize the data to be sure there's no cross-site scripting or SQL injections to be found. This is a great reference if you're looking to get started with the filter extension.
voice your opinion now!
data filter extension pear tutorial example
ProDevTips.com: Pagination with PHP Doctrine
by Chris Cornutt September 04, 2008 @ 09:30:06
The ProDevTips blog continues their series on using Doctrine in a sample application in this new part, a look at paginating the results from your database query.
Things are starting to become more and more feature complete. Let's look at how to implement general search and pagination.
They define the search to perform ($searchConf) and the pagination parameters ($pageConf) and apply them to their current Doctrine setup applying a simple layout to make the numbered links for switching between pages. They also define the search() method that pulls the results from the table to push into the pagination component.
voice your opinion now!
pagination doctrine configure search template tutorial
Jani Hartikainen's Blog: Understanding Doctrine's NestedSet feature
by Chris Cornutt September 02, 2008 @ 10:29:56
On his CodeUtopia blog Jani Hartikainen gives an inside look at a feature of Doctrine, nested sets.
The Doctrine library comes with a feature called nested set, which makes saving trees in a database easy. However, it's quite easy to accidentally cause a lot of extra unneeded queries if not being careful. Here are some pointers to keep in mind while working with the nested set, and some example queries to make understanding it easier.
He gives an example, showing how to get rows from the database - parent and child - and some optimization tips to keep things light. There's also some pros and cons included for doing it either way (the standard fetching or using the more optimized versions).
voice your opinion now!
doctrine nestedset feature fetch database row parent child
ProDevTips.com: File Uploads with PHP Doctrine
by Chris Cornutt September 01, 2008 @ 10:37:50
The ProDevTips blog has posted the fifth part of their look at using Doctrine with PHP. This time they focus on file uploads.
It's time to take a look at how file uploads can be integrated into the Doctrine validation and CRUD process. We will have a product in the form of a digital download as an example, it will have a screenshot image that can be maximum 250 pixels wide and high. The download itself will be a zipped file.
They set up their table definitions first and set up a few validation functions (update, insert and for the file data) to work on top of that. Custom upload/uploadImage and save methods handle the user's submission while a simple delete method makes removing images easy.
voice your opinion now!
file upload doctrine tutorial database table insert image
ProDevTips.com: CRUD with PHP Doctrine
by Chris Cornutt August 25, 2008 @ 11:19:37
In a fourth part of their series looking at using Doctrine in PHP, the ProDevTips blog moves on to implementing it in a typical CRUD interface.
They create the links between the tables (two hasOne relationships), a search() method to find the destinations for a user, a sorting method to multisort based on the subkeys of the value passed in and the methods for updating the information already in the database.
That's it for now, feel free to download this tiny Smarty and Doctrine framework. Note that for this to work you have to put Smarty and Doctrine in the lib folder. There is a login interface involved, just click submit there without entering anything. There is also an SQL file in the trip_selector folder if you want to try this out with some test data (same as in the picture above).
voice your opinion now!
doctrine crud relationship update create retrieve delete
ProDevTips.com: Extending PHP Doctrine Record - Check Box Groups
by Chris Cornutt August 12, 2008 @ 13:26:36
In the third part of the series dealing with using Doctrine in your PHP applications, ProDevTips has this third part looking at a method for extending the tool's current functionality.
I simply knew we would need the extension capability that the Mdl class allows for sooner or later, I didn't expect it to be this soon though. The main problem here is saving a many to many relationship straight to the database from the $_POST array, to do that we can extend Doctrine Record with a new function I have named fromArrayExt which adds something extra to the normal fromArray method.
He shows how to extend the classes to create custom handlers for a grouping of checkboxes. The new code automatically handles their submitted values and pushes them directly into the database (with a simple save() call).
voice your opinion now!
doctrine record tutorial checkbox extend group
Helgi's Blog: PEAR installer updating its PHP deps
by Chris Cornutt August 12, 2008 @ 12:04:26
Helgi has posted about an update to the next alpha release of PEAR to remove support for certain versions of PHP:
For the next alpha release of PEAR that will happen in 2 - 4 weeks we'll have a min dep of PHP 4.4 and 5.1.6, so basically excluding 5.0.0 - 5.1.5 Now why am I going to do that?
This pushes more people up from the PHP 4.3.x series (to the 4.4.x that was the last PHP4 release) and up to a more recent PHP5 version for the future. Eventually, PHP4 support will be dropped all together, but for now there's a bit of a hold out.
voice your opinion now!
pear installer dependencies php4 php5 support version
ProDevTips.com: Table of contents for Working with Doctrine
by Chris Cornutt August 08, 2008 @ 15:10:03
Henrik has posted the second part of his look at using Doctrine, this time in combining it with Smarty. (Check out part one here).
We are creating an MVC setup where M is Doctrine, V is Smarty and C is our own stuff we do here. The Zend Framework has been reduced to just another component library for me now, I will pick goodies when I need them.
He shows how to be "empowered, not stifled" by the framework and to combine the two technologies in a flexible, lightweight platform. His example is a simple signup form that, on submit, saves the information to the database via the Doctrine layer.
voice your opinion now!
zendframework smarty doctrine framework mvc tutorial
Dhiraj Patra's Blog: Caching PHP Programs with PEAR
by Chris Cornutt August 07, 2008 @ 12:58:09
In a recent post to his blog Dhiraj Patra looks at the caching functionality that PEAR has to offer via the PEAR Cache package.
Caching is currently a hot topic in the PHP world. Because PHP produces dynamic web pages, scripts must be run and results must be calculated each time a web page is requested, regardless if the results are the same each time. In addition, PHP compiles the script every time it is requested. [...] PEAR's Cache package offers a framework for the caching of dynamic content, database queries, and PHP function calls.
He talks a bit about what kind of methods are included with the package and shows examples of how it works for function call caching, caching the output from the script execution and how to implement your own custom caching extension of the main code to make it even more flexible.
voice your opinion now!
pear cache tutorial function call output custom handler
ProDevTips.com: Doctrine for dummies
by Chris Cornutt August 05, 2008 @ 12:55:52
Henrik waves goodbye to the Zend_Db component of the Zend Framework in this new post to the ProDevTips blog - his new favorite is Doctrine.
It was long overdue but finally I've taken a look at Doctrine. And I'm blown away, bye bye Zend DB. [...] It's time to try and convey how awesome I think Doctrine is.
His example sets up a table definition and defines the associations between the columns for a "members" table. He defines a "city" table too and shows how Doctrine can easily combine the two and make selecting from and inserting into the tables simple.
voice your opinion now!
doctrine database abstraction layer zenddb
Jacques Marneweck's Blog: Grab PEAR via CVS is you need it
by Chris Cornutt August 04, 2008 @ 09:34:40
Jacques Marneweck has a quick reminder for those trying to get the latest PEAR installer - you can always get it from CVS.
Quick note that the PEAR installer is missing (go-pear.org has expired and has been snapped up by some cybersquatters) and http://pear.php.net/go-pear renders a 404. So the current solution is to grab the go-pear install from CVS.
A quick curl call to a url on the cvs.php.net site (in the /pearweb directory) is all it takes to grab the latest. The page it's pulling is the source for the go-pear.php installer that can be run either from a web browser or from the command line (with a PHP binary).
voice your opinion now!
pear cvs gopear installer curl pearweb
Francois Zeninotto's Blog: Comparing Propel, Doctrine and sfPropelFinder
by Chris Cornutt July 09, 2008 @ 10:24:59
Francois Zeninotto has posted a comparison of three different ORM (Object Relational Mapping) layers for PHP - Propel, Doctrine and sfPropelFinder (the last being a plugin of the symfony framework).
When it comes to ORMs, it's all a matter of preference. Is it, really? This post compares side-by-side the code required to perform some simple operations with three OO database requesting API. The purpose is to demonstrate that productivity, and not only style, can vary a lot depending on the ORM you choose.
He's worked up a long list of examples including methods to:
- Retrieving an article by its primary key
- Retrieving the latest 5 articles
- Retrieving articles based on a complex AND/OR clause
- Retrieving articles authored by people of a certain group
- Retrieving an article and its category by the article primary key
- Retrieving articles and hydrating their author object and the author group
Each one comes with their own (usually simple) code. His conclusions point out different "bests" of each - like sfPropelFinder being the "most magic" and that some of the limits of Propel are very frustrating.
voice your opinion now!
compare orm layer doctrine propel sfpropelfinder symfony framework
SaniSoft Blog: Code sniffs for CakePHP and then some more
by Chris Cornutt July 04, 2008 @ 09:32:00
On the SaniSoft blog Tarique Sani has posted about (and made available for download) some code sniffs for the CakePHP framework. Some problems arose with some of the naming that the framework uses, but with some "tinkering around"...
[It became] apparent that I had to have my own set of Cake sniffs to manage this but a separate standard just for this seemed an over kill and the simplicity of code made it kind of fun to add more standards which I liked but were in different set of sniffs.
You can grab the whole list of sniffs from their downloads. They implemented them as a pre-commit hook on their SVN server even so that developers could not violate the coding standards when they submit their code.
voice your opinion now!
sanisoft sniff pear package phpcodesniffer svn commit hook cakephp
Jonathan Street's Blog: Windows Live Contacts coming to PEAR
by Chris Cornutt June 30, 2008 @ 08:41:02
In a new entry to his blog, Jonathan Street talks about a new wrapper class he's built up around the Windows Live Contacts service.
It was a shame really as it was a really exciting project with Microsoft leading the way in the area. It's been only recently that Google and Yahoo have caught up and released their own APIs for accessing their users data. [...] With the possibility of actually using the code myself creeping up on the horizon I decided to put the time in to write wrappers for PHP. It can be broken down into two components.
These two components are the delegated authentication, used to get permission from the user to grab the data, and the actual interface to the Windows Live Contacts data. Both packages have been submitted to PEAR.
voice your opinion now!
windowslivecontacts pear package authentication
DevX.com: Generating Reports and Statistics in PHP
by Chris Cornutt June 27, 2008 @ 10:26:31
The DevX site has posted a new tutorial talking about their method for creating reports and generating statistics based off of data from your PHP application.
Statistics and reports analyze the change over time of any kind of phenomena. [...] For the software industry, statistics and reports provide both an ongoing challenge and an ongoing market. At present, programming languages such as PHP and Java come with built-in packages for developing applications around statistical problems.
They use two PEAR packages for the statistics - Text_Statistics and XML_Statistics to pull in different kinds of data and extract results from it. The next step is to make a meaningful report out of these numbers - that's where PHPReports comes in. It's a simple tool that makes simple reports for you that can then be styled with CSS however you'd like.
voice your opinion now!
tutorial report statistic pear package textstatistics xmlstatistics phpreports
Padraic Brady's Blog: PEAREncryption and Zend_Crypt Revisited
by Chris Cornutt June 17, 2008 @ 15:32:50
Padraic Brady has a new post today mentioning both the PEAR::Encryption package and the Zend_Crypt component of the Zend Framework.
It's been a while since I did some active ZF/PEAR component development. It's been one of those 6 month periods where time to commit was a rarity for a few reasons. So now that I'm back on the road, where to?
He sets his sights on the Zend_Crypt component and details some of the encryption methods it contains - HMAC, the Diffie-Hellman Key Agreement Protocol, a hashing wrapper and proposed support for a RSA public key cryptography. He mentions that a lot of this support is already in a beta package for PEAR.
voice your opinion now!
pear encryption package component zendframework zendcrypt
David Coaller's Blog: To a great upcoming year
by Chris Cornutt June 17, 2008 @ 11:17:38
David Coallier has posted both a congratulations and thank you about the PEAR group elections. Congrats to those who were voted in including Joshua Eichorn, Christian Weiske and Travis Swicegood and his many thanks for being voted in as President:
My place as I consider it and as Greg mentioned on the mailing list yesterday is much more "ambassadorial" than "presidential" and being the PEAR ambassador around the world, I'll be glad to discuss, argue, improve the general idea of PEAR to anyone. I'll also be happy to discuss PEAR2 if anyone is interested but first and foremost I'll be happy to help our new PEAR Group (which I am pretty sure won't need help ) and the community.
You can find out more about the results of this year's elections on the PEAR election pages from pear.php.net.
voice your opinion now!
election pear president amabassador group
Zend Developer Zone: Getting Started with OpenID and PHP
by Chris Cornutt June 05, 2008 @ 10:27:20
Vikram Vaswani has a new tutorial posted to the Zend Developer Zone today about integrating PHP with an OpenID system via a few helpful packages.
OpenID, a free, open-source framework for "single sign-on" across different Web sites and applications. The even better news? There already exist a bunch of PHP widgets that allow developers to easily integrate OpenID into a PHP application, and this article is going to show you how to use them. So what are you waiting for? Flip the page, and let's get going!
For those not familiar with the authentication method, he defines OpenID and shows how it can help with the "too many passwords, too many accounts" problem many users face. He uses the PHP OpenID Library and the Authentication::OpenID_Consumer PEAR package (as well as several other PEAR packages to help with the connections and message formatting). He builds two simple forms to use the service - one to authenticate a user and another to create a new account.
voice your opinion now!
openid tutorial connect authenticate myopenid pear package
Ken Guest's Blog: Book review PHP Objects, Patterns and Practice (second edition)
by Chris Cornutt June 04, 2008 @ 07:58:39
Ken Guest has posted a review of yet another PHP-related book from APress publishing, "PHP Objects, Patterns and Practice (Second Edition)".
While being an easy read, this is a well written, serious book and is aimed squarely at enterprise-level developers and software engineers who make their living through the development and architecture of solutions developed in PHP.
He breaks down the book into the three sections its title mentions - working with objects, design patterns and a healthy dose of PEAR, phpDocumentor, PHPUnit, CVS and phing.
voice your opinion now!
book review apress object pattern pear phpdocumentor cvs phpunit phing
Ken Guest's Blog: The Date_Holidays package, a pack of splitters and a pear tree
by Chris Cornutt May 09, 2008 @ 12:56:39
In a new post to his blog today, Ken Guest talks about the split that's been made in a PEAR package for calculating the dates of holidays (Date_Holidays) for localization reasons.
We decided that this one package should be split into subpackages: one subpackage per region/country. Some advantages of this approach are that each driver / filter / subpackage gets it's own stability and version number - we wouldn't have to keep increasing the version number of Date_Holidays each time a new driver is added or when an existing driver gets a significant number of fixes.
To replace your current version of the package (with all of the regions built in) with a new version that still contains all versions, uninstall the Date_Holidays and grab the "Date_Holidays#all" package. Otherwise, you can check out the PEAR page for the main package and see the subpackage list if you only need one for your area.
voice your opinion now!
dateholidays pear package split regional filter driver subpackage
Community News: PEAR Group Elections 2008-2009 (Nominations)
by Chris Cornutt May 06, 2008 @ 16:09:04
Time has come back around for the 2008-2009 PEAR group elections and David Coallier has posted some details about this year's elections.
It is now this time of the year again where the PEAR Group throws in the PEAR Group Nominations. The nominated people will then be called for votes by the community and 7 lucky (even though luck has nothing to do with it) will be elected as the new PEAR Group member for the year 2008-2009.
The entire PHP community is requested to nominate who they think would make the best addition to the group, regardless of how they're related to the PEAR project. Nominations should be sent to Martin Jansen by midnight (UTC) May 31st.
voice your opinion now!
pear group nominate election matrinjansen email
PHPBuilder.com.au: Powerful Web Services with PHP and SOAP
by Chris Cornutt April 30, 2008 @ 08:43:28
In a new article from PHPBuilder.com.au today, they talk about the "powerhouse of web services", SOAP, and how to get started working with it in PHP.
You've tried your hand at building mashups, experimented with a few RESTful Web services, maybe even started your own. Sure, you've got data sharing working. But how do you make your Web applications really talk to each other? In this tutorial, I'll show you how to take your Web applications to the next level with SOAP.
They opt to go with the NuSOAP method to consume another service and create your own simple one. They include a few code examples for either side and a (very) brief look at doing some debugging with what NuSOAP has to offer. One thing to note - if you have PHP5's SOAP extension compiled in and working, NuSOAP will throw an error about redeclaring a class name. This is because of a conflict between the naming of the SOAP extension's methods and NuSOAP.
voice your opinion now!
soap tutorial nusoap client server pear package
New Earth Online: Caching PHP pages
by Chris Cornutt April 21, 2008 @ 09:31:40
The New Earth Online has a quick look at one easy method for speeding up your site in a few different ways - caching pages and information with things like Cache_Lite and APC.
As your site traffic grows it takes longer and longer to generate a dynamic page from sending multiple queries to a database. One possible solution to limit queries is to cache the result of each query that is needed, or to have a complete full page cache for your site.
They look at the two ways I mentioned - the Cache_Lite PEAR package and the APC extension (that will soon be included by default in the stable PHP releases). Bits of code are provided for each showing how to get them set up and get them working inside of your application.
voice your opinion now!
cache page apc pear cachelite tutorial install
PEAR Blog: First PEAR bug triage over!
by Chris Cornutt April 03, 2008 @ 10:26:34
According to this post on the PEAR blog, the first PEAR bug triage is now over:
PEAR's bug tracker hit the 600+ open bugs mark a month ago. [...] So with 600+ open bugs (not including the feature requests), we had to do something. [...] The logical step was to hold our own bug smashing event and see how it works for PEAR.
Back on March 22nd and 23rd (Easter weekend) they hunted for bugs. Several developers showed to help out and many bugs were fixed and they managed to bring the number of open bugs for PEAR down to 547 with the two days of work. There were some milestones reached too:
Thanks to the triage, we are close to reaching two important milestones: Closing bug reports with lower bug ID than 1000 (1 bug left!) and 2000 (5 left).
voice your opinion now!
pear bug triage close problem issue feature event
Zend Developer Zone: Reading and Writing Spreadsheets with PHP
by Chris Cornutt April 03, 2008 @ 08:49:19
On the Zend Developer Zone, Vikram Vaswani has posted a tutorial that shows hos to "break the language barrier" between PHP and Microsoft's Excel to allow for the reading and writing of spreadsheet data directly from one to the other.
When it comes to playing nice with data in different formats, PHP's pedigree is hard to beat. Not only does the language make it a breeze to deal with SQL result sets and XML files, but it comes with extensions to deal with formats as diverse as Ogg/Vorbis audio files, ZIP archives and EXIF headers. So it should come as no surprise that PHP can also read and write Microsoft Excel spreadsheets, albeit with a little help from PEAR.
After grabbing the different parts needed (the PHP-ExcelReader package and the Spreadsheet_Excel_Writer PEAR package, he shows how to create a simple spreadsheet with just numeric information in it. For something a bit more interesting, he goes the other way and shows spreadsheet data as an HTML table.
Other examples included as well are things like: pushing spreadsheet data into a database, working with formulas and styling it to your liking.
voice your opinion now!
spreadsheet excel pear package phpexcelreader writer tutorial
Symfony Blog: Upgrade your plugins
by Chris Cornutt March 20, 2008 @ 12:03:06
The Symfony project is recommending you upgrade your plugins to the latest editions - an issue with the PEAR channel caused it to load the wrong ones:
A problem in the symfony project PEAR channel made the plugin-install task always install the oldest version of the plugins, instead of the latest. If you recently installed plugins with the symfony command line, you probably installed an outdated version. Plugins installed via SVN are not affected.
You'll need to run a plugin-upgrade command for each of the plugins installed on your system to ensure that you're completely up to date. The post has complete info on how to tell which plugins you have and the exact commands to issue to being them up to date.
voice your opinion now!
symfony framework upgrade update plugin pear channel
Jonathan Street's Blog: Is PHP good enough for science?
by Chris Cornutt March 20, 2008 @ 09:32:41
On his blog today, Johnathan Street poses a question - is PHP "good enough" to be used in the scientific community?
There is an accelerating trend in Biology to make data and tools available via web interfaces. In my opinion this is an environment where PHP excels and yet all the literature I've seen discussing the development of these services uses Perl or occasionally Java.
He came across two science-related PEAR packages that were created back in 2003, but not too much since then. He wonders if there's anyone else out there that might feel like PHP is a perfect fit for some of the sort of applications the scientific community could need.
So my question is this. Is anyone out there using PHP in a scientific environment? Are there resources available which I've missed?
voice your opinion now!
science application pear package project
Stefan Mischook's Blog: PEAR vs. Zend Framework
by Chris Cornutt March 14, 2008 @ 07:56:53
On his blog today, Stefan Mischook compares two of the popular component libraries out there - PEAR and the Zend Framework (yes, it can be considered a grouping of components too).
Now that the Zend Framework is ready for 'prime time', I've been considering the Pear framework with regards to how it now fits in the PHP world.
He suggests that not could both be considered component libraries, but might also both be frameworks (based on a definition that a framework is a "consistent set of components that are designed to work together in a unified manner"). He also asks about the need for something like PEAR now that the Zend Framework has come along, getting Jonathan Lebensold's opinion too.
voice your opinion now!
pear zendframework compare need component framework library
Tony Bibbs' Blog: Zend Framework's Official PEAR Channel?
by Chris Cornutt February 14, 2008 @ 16:02:00
In this new post to his blog today, Tony Bibbs asks a question that pops up every once and a while surrounding the Zend Framework - why don't they use the PEAR package distribution methods to handle the releases of the framework? (Specifically as pertains to PEAR channels)
Why hasn't Zend provided an official PEAR channel? In my search for an answer I found this response from "bkarwin": No, we have no plans to offer ZF under a PEAR channel or other piece-by-piece distribution method. Assuming bkarwin was working in some half-official capacity at Zend I'd simply ask "Why not?".
Tony wonders why, if the PEAR group (and project) has such a good thing already in place, it can't just be adapted to make releases of the various components of the framework simpler than having to wait for a whole new release to get the fixes the users need.
voice your opinion now!
zendframework pear package release bugfix component
Zend Developer Zone: Creating Data Tables With PEAR Structures_DataGrid
by Chris Cornutt January 28, 2008 @ 16:19:30
Cal Evans has posted a tutorial on the Zend Developer Zone (posted today) about using the PEAR Structures_DataGrid package to create quick and easy data tables.
In this article, I'll be introducing you to the Structures_DataGrid package, showing you how it can be used to display structured data in tabular form. I'll be showing you how to hook it up to various data sources (including a CSV file, an RSS feed and an Excel spreadsheet), and how to format the resulting output so it's as pretty (or as ugly) as you want it to be.
They talk about what you'll need to get started (the different packages for different kinds of data) and some sample code to help you down the path to more attractive tables. There's even a bit touching on some of the more advanced features like exporting to Excel, pagination and data sorting.
voice your opinion now!
pear package structure datagrid table tutorial
DeveloperTutorials.com: Effective Geotargeting with PHP
by Chris Cornutt January 28, 2008 @ 09:47:00
The Developer Tutorials blog has a new article that talks about their method for creating simple geotargeting for your visitors.
In this tutorial, we'll take a look at the technique of geotargeting, or serving content to users based on their physical location. The technology is invaluable; with simple techniques, you can target advertising to specific users, collect more accurate usage statistics, serve content in different languages for different regions and provide local information like weather reports to your visitors.
They use the GeoIP services offered by Maxmind to perform the IP to location translation and the PEAR package already created to make the integration as painless as possible.
voice your opinion now!
geotargeting tutorial geoip maxmind pear package
Helgi's Blog: New features and changes in pear.php.net
by Chris Cornutt January 08, 2008 @ 12:50:00
Helgi has posted about the updates that have recently been made to the PEAR website (pear.php.net) to help correct some issues and bring in some new features.
I just did a new release of pear.php.net which has a bunch of new features and bug fixes, most of which you can see here.
Some of the updates include:
- One column design instead of the 2 column design
- Usage of the YUI CSS reset + fonts
- The package list on http://pear.php.net/packages.php doesn't highlight deprecated packages anymore
- Now developers can see bug reports by unconfirmed accounts
- The RSS feeds now contain new line breaks!
- Patch uploading during ticket creation now works
He also specifically mentions some of the feedback he's gotten on certain things (like the new layout, the CSS of the site and the DES passwords) and explains some of the rationale behind their update/use.
voice your opinion now!
pear website update feature change layout password css pear website update feature change layout password css
Zend Developer Zone: Generating and Validating Web Forms With PEAR HTML_QuickForm
by Chris Cornutt November 12, 2007 @ 14:32:00
On the Zend Developer Zone today, Vikram Vaswani has a tutorial posted introducing the PEAR HTML_QuickForm package and how to use validation right along with it.
Over the next few pages, I'll be introducing you to one of PEAR's most powerful tools for generating Web forms and validating the input that arrives through them: the HTML_QuickForm package. This package provides a flexible, reusable library of methods that can literally save you hours of time when dealing with form-based user input - and best of all, it's free and extremely easy to use. So what are you waiting for? Jump right in, and let's get going!
You'll need to be familiar with some of the technologies before getting started (it's not going to teach you PHP) and you'll need to have the software setup and ready with the HTML_QuickForm package installed. There's lots of different examples of form creation (including generated from database information) as well as information on the rules you can apply to your form elements to check on the user input (like alphanumeric, maximum length and matching a regular expression).
voice your opinion now!
html pear pacakge quickform tutorial validation html pear pacakge quickform tutorial validation
Padraic Brady's Blog: To PEAR or not to PEAR? And how to PEAR anyway?
by Chris Cornutt October 24, 2007 @ 08:04:00
In his latest post, Padraic Brady takes a look at PEAR in a verb form - both in how you can use it and what sorts of things it has in store.
over the last few months after finally getting over my ignorance of PEAR beyond it being a hodge podge of packages of dubious quality I've been questioning whether pearifying my future and past code is worthwhile. The answer is a resounding YES.
Unfortunately, there are some barriers for most people to get into the PEAR world (including the lack of the "coolest packages") with some of the perceived barriers including:
- PEAR will require large scale changes to my shiny new cool code
- PEAR only allows proposals for complete functional code
- PEAR is elitist
- PEAR is fossilised
He also talks about PEAR packages and dispels one of the most popular myths about the package repository - "you can't use PEAR on a shared host".
voice your opinion now!
pear package perceived barrier repository pear package perceived barrier repository
Joshua Eichorn's Blog: PEAR2 Unconference
by Chris Cornutt October 11, 2007 @ 14:22:04
Though there's no slides for his unconference PEAR2 talk, Joshua Eichorn has posted some of his planned features for the update to the popular PHP package repository:
I do have a list of new features planed(or already implemented) for the Pyrus installer.
The list includes:
- no installation necessary. It runs out of the box as a .phar. No go-pear.phar needed
- Pyrus is much more development/production-oriented, and will have a "deploy" command for managing deployment of development code to a production server
- out-of-the-box supported packaging formats include .tar, .tgz, .tbz, .zip, and .phar
- PHP 5.3+-based code means it fully utilizes cutting edge PHP features such as SPL iterators, XMLReader/XMLWriter, ZIP extension, phar extension (if enabled), exceptions
- full application support is available with the new www and cfg (configuration file) roles
Check out his post for more items on the list.
voice your opinion now!
zendcon2007 pear unconference pear2 update package zendcon2007 pear unconference pear2 update package
ONLamp.com: Quick and Clean PHP Forms
by Chris Cornutt September 14, 2007 @ 07:57:00
On O'Reilly's ONLamp.com website today, there's a new tutorial posted walking you through the creation of online forms through the amazingly helpful PEAR HTML_QuickForm package.
As its name suggests, the PHP Extension and Application Repository (PEAR) library called HTML_QuickForm can be used to quickly and cleanly to produce validating HTML forms, relieving the developer of the tedium that often accompanies such tasks. [...] This tutorial presents a basic implementation of HTML_QuickForm to produce a common email contact form and explores ways to get the most from this powerful library.
They introduce the topic by explaining when is a good time to use the package. Now that you're sure you want to use it, they move on to the code portion of the tutorial - the creation of an email form. They define the fields (their labels, types and required status) and show how to dump that array into the HTML_QuickForm class to create the HTML field output. They also add validation rules to check the contents of the field - in this case, ensuring that all of the entries have values and aren't empty.
voice your opinion now!
pear htmlquickform form tutorial package pear htmlquickform form tutorial package
PHPClasses.org: PHP Programming with PEAR
by Chris Cornutt September 10, 2007 @ 12:03:00
The PHPClasses.org website has a new book review posted today covering one of Packt Publishing's PHP-related publications: "PHP Programming with PEAR".
If you want to learn how to use the most relevant PEAR packages with great detail, "PHP Programming with PEAR" must be in your bookshelf, definitely. [...] "PHP Programming with PEAR" is a mandatory book, especially if you are thinking about using PEAR on a daily basis to increase your productivity, or if want to improve your skills on the use of the covered packages.
The reviewer, Marcelo Santos Araujo, goes into a bit of detail on the contents of the book too - chapters talking about MDB2, data display packages, working with XML, web services and date/time functionality.
Check out the Packt Publishing page for the book for more info.
voice your opinion now!
programming packt publishing book review pear programming packt publishing book review pear
DevShed: Developing SOAP Clients using PHP
by Chris Cornutt August 15, 2007 @ 07:56:00
DevShed has a new article posted today - a tutorial walking you through a sort of brief history of SOAP support in PHP and some working examples of each - NuSOAP, PEAR::SOAP and PHP's SOAP extension.
SOAP (Simple Object Access Protocol) provides a flexible communication layer between applications, regardless of platform and location. As long as both the server and the client speak SOAP, they can communicate. A PHP-based web application can ask a Java database application to get some information. In this article we will try to focus on different methods of developing SOAP web service clients in PHP.
They start with a look at NuSOAP and the creation of both a client and server (as well as an example on how to use some of its debugging. Next up is PEAR::SOAP, a powerful package that simplifies much of the same functionality NuSOAP has to offer. Finally, they get to the most recent SOAP functionality for PHP, the PHP SOAP extension that comes loaded with PHP5 installations by default. This includes a brief overview of its API and code examples that, in a few lines, do what takes the others twice as much.
voice your opinion now!
soap client server nusoap pear soap extension tutorial soap client server nusoap pear soap extension tutorial
Zend Developer Zone: Paging Data Sets With PEAR Pager
by Chris Cornutt August 06, 2007 @ 15:15:40
On the Zend Developer Zone today, there's a new tutorial covering the use of the PEAR Pager class to break sets into smaller sets for all sorts of data sets (not just database results).
PEAR's Pager class, [which] offers developers a framework for breaking large data sets into smaller chunks, or pages, for greater readability or easier navigation. Pagination is important, particularly when dealing with result sets containing hundreds or thousands of items, because it allows the user to exert some degree of control over which segment of the data set is visible at any given point, and thus avoid drowning in a never-ending sea of data.
Cal explores the functionality this powerful little class has under the hood including working with pagination of normal arrays, database results and XML information. Of course, code is provided through out and screenshots are posted where needed to show what the output should look like.
voice your opinion now!
pear pagination pager class tutorial array xml database pear pagination pager class tutorial array xml database
Kevin van Zonneveld's Blog: Speedup your website with Cache_Lite
by Chris Cornutt August 02, 2007 @ 09:31:00
Kevin van Zonneveld has a quick new tutorial he's written up covering the installation and use of the Cache_Lite software to increase performance on your site.
Every time a request hits your server, PHP has to do a lot of processing, all of your code has to be compiled & executed for every single visit. Even though the outcome of all this processing is often identical for both visitor 21600 and 21601. So why not save the flat HTML generated for visitor 21600, and serve that to 21601 as well? This will relieve resources of your web server and database server because less PHP often means less queries.
The Cache_Lite PEAR package makes it simple to cache both entire pages or just small parts. He shows the installation (through aptitude on Ubuntu) and how to use it in a simple code example that stores the cached copy to the local drive for a given amount of time.
voice your opinion now!
cachelite pear cache component page performance cachelite pear cache component page performance
IBM developerWorks: Turn SQL into XML with PHP
by Chris Cornutt July 25, 2007 @ 09:21:00
On the IBM developerWorks site today, there's a new tutorial by Vikram Vaswani walking through the use of the XML_Query2XML PEAR package to pull data from your SQL database and push it into an XML structure.
Ever wished for an easy way to transform SQL result sets into XML? It's a PEAR package named XML_Query2XML, and it provides a comprehensive framework to efficiently turn the results of a database query into a customizable XML document. This article introduces the package, and demonstrates useful real-world applications, including using it with XSL and XPath, combining it with data from external Web services, and creating database dump files.
They go through the installation and the steps to create the XML:
- Convert SQL to XML
- Transform XML output with XSL
- Customize XML output
- Work with SQL joins
- Filter SQL records with XPath
- Merge data from multiple sources
- Create database backups
Check out the full tutorial for an excellent guide to using this powerful PEAR package.
voice your opinion now!
pear xmlquery2xml xsl xpath join install backup pear xmlquery2xml xsl xpath join install backup
Pádraic Brady's Blog: PHP OpenID 2.0 library for PEAR Updates
by Chris Cornutt July 24, 2007 @ 12:53:00
Pádraic Brady has posted two new updates about his OpenID library for PEAR - one concerning the previous version being available from a subversion repository and the other about some updates to the source.
From the first post:
So after a few days throwing around code in an IDE, a small amount of swearing, and an overdose of caffeine, I have committed initial OpenID PHP5 code in it's shiny new PEARified form to subversion. What this means is that after a few more days of completion to work out major kinks, the PEAR-Dev mailing list will be notified of a new OpenID Consumer proposal ;-). A Server proposal will follow at a later date, i.e. when the dull ache in my forearms subsides. The repostory: http://svn.astrumfutura.org/pear/trunk/OpenID/
And, from the second post:
Just a quick update on the PHP OpenID 2.0 library being proposed to PEAR. The library is a PHP5 implementation of the OpenID 2.0 Authentication Specification. It's currently only including a Consumer (so you can build OpenID authentication into websites) but a Server is already in the works for later.
Be sure to check out both of these posts for lots more information than's presented here. Pádraic's worked hard on the package - check out the alpha code at http://svn.astrumfutura.org/pear/trunk/ to see just how much.
voice your opinion now!
pear openid library package subversion source pear openid library package subversion source
Matthew Weir O'Phinney's Blog: File_Fortune refactored
by Chris Cornutt July 06, 2007 @ 09:36:00
In a new blog entry today, Matthew Weir O'Phinney talks about updates (and refactoring) that he's done to a PEAR package he's developed, File_Fortune.
Over the past few evenings, I've refactored File_Fortune to have it implement Iterator, Countable, and ArrayAccess -- basically allowing it to act like an array for most intents and purposes. As a result, I've eliminated the need for the File_Fortune_Writer package, and greatly simplified the usage.
The package is designed to make an interface between the casual PHP user and the fortune files common on most *nix machines. To illustrate he update, he includes some code that grabs the fortune file, parses it to grab a random one and echoes them out. Also included is the save() method so you can add your own to the list easily.
voice your opinion now!
filefortune refactor pear package fortune filefortune refactor pear package fortune
Padraic Brady's Blog: More OpenID (in PEAR and Refactoring)
by Chris Cornutt June 26, 2007 @ 11:49:00
Continuing on with his look at his OpenID library and its implementation, Padraic Brady has two new posts with more of the story.
From the first post:
As a follow on from my previous entry about OpenID in the Zend Framework, I've been in brief contact with Dmitry Stogov across a scattering of emails. Dmitry posted his OpenID proposal for the framework over at the Proposals Wiki earlier in the week. [...] It's actually very hard to comment constructively rather than simply handing over my code which probably says a lot more all by itself. [...] Anyway, I've agreed to port my OpenID library to PEAR as a PHP5 package. I checked with the mailing list, and the approach I've taken in splitting the library across a number of freestanding components hasn't seen any objections. On the flipside, it does help by providing upgrades to existing PEAR Encryption packages which are not yet migrated to PHP5 versions.
And from post number two:
Over the weekend, I managed to grab a few hours to dig around my OpenID library with the ultimate development tools: patience and experimentation. [...] What I've refactored towards is a splitting of the OpenID process based on three categories: Request, Redirect, Response.
voice your opinion now!
openid library zendframework pear refactor openid library zendframework pear refactor
DevShed: Databases and PHP
by Chris Cornutt June 14, 2007 @ 12:08:00
DevShed has started a new series looking at working with PHP and databases with this new tutorial posted today, an excerpt from the O'Reilly book "Programming PHP, Second Edition".
We focus on the PEAR DB system, which lets you use the same functions to access any database, rather than on the myriad database-specific extensions. In this chapter, you'll learn how to fetch data from the database, how to store data in the database, and how to handle errors. We finish with a sample application that shows how to put various database techniques into action.
In this first part of the series, they look at what kinds of things are possible with the database connection, some of the basics of using the PEAR DB class and working with data source names to help with the connection.
voice your opinion now!
database tutorial pear oreilly excerpt programming database tutorial pear oreilly excerpt programming
Travis Swicegood's Blog: Book Review The PEAR Installer Manifesto
by Chris Cornutt June 11, 2007 @ 07:47:00
Travis Swicegood has posted a book review he's done on the PEAR Installer Manifesto, a book by Greg Beaver detailing the use of the PEAR installer, channels and the creation of a blogging application to put them both to use.
From Travis' review:
This past weekend I read through the PEAR Installer Manifesto. For anyone who's not familiar the PEAR installer and how it can be used in projects outside of PEAR, I would point them to this book. [...] This is a four star rating, so there were a few things that weren't exactly what I had hoped for. I hoped this would serve as a full reference to the installer. While this book takes you a lot of great jumping off points, it doesn't have the thoroughness I wanted.
The book does cover things like how to create and work with PEAR channels and how to create a custom plug-in system by embedding the Installer into an application. Overall, he gives the book positive marks with only a few complaints (like the lack of a full reference to the installer being included).
voice your opinion now!
pear bookreview installer manifesto packt pear bookreview installer manifesto packt
Community News: PEAR Installer version 1.6.0 released
by Chris Cornutt June 08, 2007 @ 12:06:00
New from the PEAR blog today is an announcement about the official released of the latest version of the PEAR installer - 1.6.0.
This release fixes a number of major regressions introduced in PEAR 1.5.2 that were not fixed in PEAR 1.5.3 or PEAR 1.5.4, and is recommended for immediate upgrade.
The march to Pyrus, the next generation installer for PEAR, and the repository of packages designed for Pyrus (PEAR2) continues. Maintenance on 1.x will continue to contain bug fixes and security fixes, but the pace of new features is going to slow considerably.
PEAR users can either download the latest package from the main PEAR site or just issue a "pear upgrade PEAR" command from their system to pull it down from the default PEAR channel.
voice your opinion now!
pear installer release upgrade pyrus pear installer release upgrade pyrus
Tony Bibbs' Blog: Geeklog_Generator 1.0.0 Released
by Chris Cornutt June 07, 2007 @ 11:17:00
Tony Bibbs points out the latest release of the Geeklog_Generator PEAR package today, version 1.0.0.
What is Geeklog_Generator? It's a package that compliments the great ORM implementation, Propel. What's missing from Propel, you ask? First and foremost, it's always annoyed me that Propel (more concisely, the Propel Generator) doesn't generate pure PHP model objects...objects that don't need to include a bunch of persistence level code.
Geeklog_Generator gets around this by building minimal, pure PHP models (called Data Transfer Objects or DTO for short) that can not only be passed around easily via web services but it also but they can be quickly turned into the persistable Propel objects.
Changes made for this release include "massive updates in preparation for GL2 GSoC and scafolding". You can grab the latest version of the package from its PEAR repository.
voice your opinion now!
geeklog propel object generatorp pear release geeklog propel object generatorp pear release
David Coallier's Blog: PEARDB is Deprecated, Got It?
by Chris Cornutt June 04, 2007 @ 15:21:00
In response to several other posts lately about the PEAR::DB package in PEAR (and things that could be done to improve it), David Coallier got a bit fed up and shared his opinion - "PEAR::DB is deprecated, got it?"
All new features are made into MDB2 and not DB, the only thing that is being done on DB is security fixes. So MDB2 is first of all, faster, smaller (Because of it's driver and modularity), easier, and has more features (LOB handling, Iterator, etc) and better end-user documentation, quite solid docs indeed.
Of course, the comments of the post are full of people arguing to keep it around and others that agree with David, especially in light of a MDB2 driver for the Zend Framework he mentions.
voice your opinion now!
pear db database mdb2 deprecated pear db database mdb2 deprecated
Sara Golemon's Blog: Why isn't this in PEAR?
by Chris Cornutt May 23, 2007 @ 10:23:00
Sara Golemon describes the path she took in a search for an OpenID library to work with in PHP. The trip took her through both PEAR and PECL with no promising results. Heading off to a Yahoo! search she comes up with one good result - Auth_OpenID.
Now, granted, this is the first OpenID system I've looked at, and I haven't really dug into it in depth, but I've got to say, this is some clean, well written code and the author clearly understands the maths involved (or at least fakes it shockingly good).
Knowing this, she asks "why isn't this in PEAR" if it's so well-structured and useful? It works with any version of PHP from 4 up and is smart enough to adapt itself to whatever the structure of your application might be.
There's also some great comments on the post where it's explained why the library isn't in PEAR, another OpenID package for PHP and suggestions for alternate distribution methods (PEAR channel).
voice your opinion now!
openid authopenid package pear php4 php5 openid authopenid package pear php4 php5
Travis Swicegood's Blog: With friends like these... (or a PEAR Contribution Story)
by Chris Cornutt May 08, 2007 @ 09:31:00
So, what happens if you try to contribute back to the community, specifically the PEAR project, and you get shot down for a proposal - even a simple one? Travis Swicegood found out:
Yesterday I proposed my first PEAR package. I've helped a few friends with packages of their own, but never got around to getting a developer account and taking the lead on a package. After hearing about the recent changes in store and the umpteenth "you should propose that" from Josh, I decided to propose one of the smaller "packages" I've used in some of my code: PHP_Callback. I say packages with quotation marks because it's really just one, simple file.
The problem wasn't in the proposal, but in the immediate responses he received for it - "it's useless", "this isn't the correct way to do this" and "it's too easy to implement on its own, it doesn't need to be in the library".
Travis' response was to be expected:
One most new-to-PHP programmers could have put together in an afternoon. I can only imagine how quickly a new developer would have unsubscribed from pear-dev and pulled his proposal if his first foray into contributing to the community had been met so quickly with such unconstructive criticism.
voice your opinion now!
pear contribue phpcallback comments pear contribue phpcallback comments
Greg Beaver's Blog: Is anything working in PEAR?
by Chris Cornutt May 07, 2007 @ 16:07:00
In response to an earlier blog post from another member of the PHP community, Greg Beaver has posted a few thoughts he's had on sharing what's really going on with the PEAR project.
Newly elected PEAR Group member Josh Eichorn posted a blog entry, "How would you improve PEAR" recently. I was impressed with the response, it seems many people outside of PEAR are monitoring it and have thought about how to make it better. However, I was also not so impressed with the poor job we've done letting people know about the newest improvements to PEAR. In my comments, I listed as many as I could think of, but Josh pointed out that I would do well to post these comments in a more public setting, so here goes.
He notes that most of the items mentioned in the comments of Joshua's post are already implemented, save for one - CVS over Subversion. He also shares his renewed obligation of working on the social issues surrounding the project and the efforts that the project is doing to help current developers (stable works the same) and development (get involved! get active!).
voice your opinion now!
pear project social issue comment improve public pear project social issue comment improve public
PHP-Coding-Practices.com: PHP Code-Beautifier Tool
by Chris Cornutt May 03, 2007 @ 07:54:00
On PHP-Coding-Practices.com, there's a new post pointing out a code beautification tool Tim dug up the (aptly named) "PHP Code Beautifier".
Today I discovered a good tool for beautifying existing PHP Code. It works via a web interface. You can either upload a script or directly input it. The code is beautified according to the PHP PEAR Standard Requirements. It does not change or debug your code in any way.
He lists the things it can do for you and your code including setting indents to four spaces, uses the "one true brace" style for function definitions, and removes spaces between things like function calls, parenthesis and beginning of argument list.
You can check out the application and get information on more of the updates it will make on the project's homepage.
voice your opinion now!
beautifier download pear standard beautifier download pear standard
David Coallier's Blog: PEAR Elections Ended! Time to get some work done!
by Chris Cornutt May 01, 2007 @ 11:54:00
As posted about on his blog today, David Coallier and others have been voted into the new PEAR group's team:
I would like to say thanks to everyone who has voted for both the rest of the Team, and I :-). So the new PEAR Group team is built of the following members: Martin Jansen, Arnaud Limbourg, Joshua Eichorn, Christian Weiske, Helgi Thormar, Paul M. Jones, Justin Patrin and finally myself David Coallier.
Team, here we go, let's get some good and solid work done! I am looking forward for such cooperation with both PEAR contributors and other frameworks out there!
He also includes a lengthy listing of some of his personal work for the upcoming months, including work on several of the PEAR pcakges - MDB2, Text_CAPTCHA_Numeral, pearweb (the PEAR website), Image_Transform, and HTML_AJAX.
voice your opinion now!
pear election group member vote pear election group member vote
Stoyan Stefanov's Blog: Image_Text 0.6 beta is out
by Chris Cornutt April 19, 2007 @ 07:47:00
In a new entry today, Stoyan Stefanov announces the beta release of the PEAR image manipulation package, Image_Text 0.6 (beta).
This is my first PEAR release and I was actually surprised how easy it is to package and roll out a release.
He also briefly describes the PEAR package release process (simple from his perspective) and what's required to make things go smoothly.
Image_Text Description:
The package provides a comfortable interface to text manipulations in GD images. Beside common Freetype2 functionality it offers to handle texts in a graphic- or office-tool like way. For example it allows alignment of texts inside a text box, rotation (around the top left corner of a text box or it's center point) and the automatic measurizement of the optimal font size for a given text box.
voice your opinion now!
imagetext pear package release beta imagetext pear package release beta
SitePoint PHP Blog: Markup Separation with Template IT
by Chris Cornutt April 13, 2007 @ 09:42:00
In a new post to the SitePoint PHP Blog today, Ian Muir shows you how to keep thing separated using the HTML Template IT extension. It helps prevent application functionality and logic from seeping its way into your output.
One of the more challenging things I've run into while doing PHP development is effectively separating presentation from program logic. In many projects, I felt I was doing a great job until I had to do a markup change and jump through a lot hurdles to make it happen. In my recent projects, I've starting using the HTML Template IT extension in PEAR, and its made things a lot easier.
By way of example, he gives code blocks - one showing an example template and the other how to populate it with your own data. You can get more information on the extension from it's PEAR page.
voice your opinion now!
tutorial searation template pear extension markup tutorial searation template pear extension markup
Amir Saied's Blog: PEAR XML_XUL at International PHP Magazine
by Chris Cornutt March 22, 2007 @ 06:57:36
Amir Saied has pointed out an article that he's done for the International PHP Magazine that's been published in this month's edition. IT's a look at generating XUL pages on the fly with PHP.
From the International PHP Magazine website:
Have you ever wanted to write a Web application that truly seems like a desktop application and has its functionality too? And did the tons of CSS you'd have to do scare you? Gecko-based browsers are awesome to render pages properly and are compatible with the latest standards. You can use XUL's magic to make a Web application look exactly like its desktop alternate. The article explains XUL and how to use PEAR's XUL package to generate XUL pages on the fly.
Be sure to check the rest of the issue too - there's articles on Ajax hype, working with REST, security tools, and the continuation of a beginner's series on PHP.
voice your opinion now!
pear xmlxul dynamic article itnlphpmag pear xmlxul dynamic article itnlphpmag
Lukas Smith's Blog: Database abstraction mailing list
by Chris Cornutt March 09, 2007 @ 08:03:00
In an effort to somewhat unify the authors of the wide range of PHP database abstraction layers out there in the community, Lukas Smith has proposed a "doctrine miling list" for the discussion of things "like best practices, new discoveries, challenges, etc".
Now I am hoping that all of you are reading this. I know quite a few of you pretty well already (John, Hans, Manuel etc.). [...] So please everybody come out of the woodwork, send me a mail or post a comment.
While I think its fine for end users to also join the list, the goal is not to create a list for end users to ask questions, but more for people who actively develop database abstraction layers. End users should better go to the respective mailing lists.
Ian P. Christian has already stepped up to the plate and is offering a mailing list that you, the database abstraction developer can subscribe to - mailto:phpdbabstraction+subscribe@lists.pengus.net. Be sure to check out the comments for more great discussion.
voice your opinion now!
database abstraction layer mailing list doctrine database abstraction layer mailing list doctrine
Greg Beaver's Blog: Vote in the first PEAR election
by Chris Cornutt February 23, 2007 @ 08:41:00
Greg Beaver has announced an "official referendum on the future of PEAR" that he has set in motion to get PEAR developers voting on proposals for where PEAR should be going.
As of February 22, 2007, I have called an official referendum on the future of PEAR. There is a news item on the front page of pear.php.net with the same instructions in this message. This election is only open to PEAR developers who have contributed to the development of a PEAR package at any time in history, but you must have the ability to log in at pear.php.net, and must have "pear.dev" karma.
There's three options - "don't change anything", Greg's constitution, or Anant Narayanan's constitution. The results will pick the path that PEAR will follow and the future of the project. If you have access and the pear.dev karma, head over here and cast your vote today.
voice your opinion now!
pear vote constitution future project direction pear vote constitution future project direction
Zend Developer Zone: Book Review - PHP Programming with PEAR
by Chris Cornutt February 02, 2007 @ 19:04:00
Cal Evans of the Zend Developer Zone has posted a new book review of one of Packt Publishing's latest PHP-related offerings - "PHP Programming with PEAR".
For those who have been living under a virtual rock for a while now, PEAR is the "PHP Extension and Application Repository". In a nutshell, it is a collection of classes, it's a framework, and it's a distribution system. Most importantly though, it's an excellent place to find the classes you need so you don't have to re-invent the wheel. (Ok, beginner's time is over, I promise).
PHP Programming with PEAR, written by Stephen Schmidt, Carsten Lucke, Stoyan Stefanov and Aaron Wormus, takes a look at some important PEAR classes and how you can use them.
He mentions what the book covers (which packages) and highlights some of his favorite bits, including the chapter on web services.
voice your opinion now!
pear book review packt package webservice mdb2 xml pear book review packt package webservice mdb2 xml
Cyberlot's Blog: PHP bugs, whos responsible? Do they even read them?
by Chris Cornutt January 26, 2007 @ 10:43:00
In this new post to his blog, Richard Thomas talks about a bug issue that he's "gotten in the middle of" and the conflict between the PHP group and the PEAR developers that came out of it.
Today I managed to get right in the middle of this. [...] Both pear and php are pointing the fingers at each other, neither seem to be able to work together and Im not even sure if either one of them has even taken the time to run my test code and realize what the issue is to begin with.
The problem comes when he created a a script with the Pear Mail, Mail_mime and Net_SMTP PEAR classes and, following the execution of the rest of the script, tried it both ways - turning the erro reporting back off or not messing with it at all. As a result, the code with the ending error_reporting() call throws an error, the one without does not.
Unfortunately, at the time of this writing both sides are still pointing at the other for blame on the issue.
voice your opinion now!
bug responsible bugfix report pear errorreporting bug responsible bugfix report pear errorreporting
Stoyan Stefanov's Blog: Using PEAR and AWS to keep an eye on Amazon
by Chris Cornutt January 11, 2007 @ 06:59:59
On his blog today, Stoyan Stefanov shows how to use a PEAR package - PEAR::Services_Amazon - to "keep an eye on" Amazon's stats for a book.
I wanted to have a page that shows the books I've written, together with their Amazon sales rank and the average customer rating and number of reviews. It's really easy. I took one example out of the PEAR book and slightly modified it.
The script needs to few things to get up and running, so he points out those (an AWS id, the PEAR pacakge) and the simple path the application will take to grab the information (request/response). Then it's on to the actual PHP code - all 60 lines of it, including the HTML for the output.
It makes the request with the Services_Amazon package for the given item numbers (he happened to have already) and pulls the results back, looping through them displaying sales rank, title, author, the average rating, and the number of total customer reviews - all in a handy unordered list.
voice your opinion now!
amazone pear pacakge servicesamazon salesrank reviews rating amazone pear pacakge servicesamazon salesrank reviews rating
Greg Beaver's Blog: Interesting, potentially critical bug in PEAR
by Chris Cornutt December 20, 2006 @ 13:16:39
Following right on the heels of a different PEAR problem, Greg Beaver has posted about a similar PEAR-related issue that could cause some serious problems for you and your installation.
After investigating (which in my case meant briefly recalling from memory how PEAR actually validates dependencies), I remembered that PEAR validates dependencies twice, once prior to download, and once prior to installation. By the time the dependencies are sorted, PEAR assumes that the sort algorithm properly sorts things.
This is actually a pretty reasonable assumption considering the unit tests that are in place to test this. However, like all regression testing, the unit tests test boundaries and likely cases, but not all possible inputs.
So, to try to figure out where things might have gone wrong, Greg does a little research to find the problem. He discovers that it has to do with the order that the "subpackages" for the dependencies are installed, where the contents of those files are not removed correctly before installation, resulting in a file conflict.
voice your opinion now!
pear critical install dependency package subpackage file conflict pear critical install dependency package subpackage file conflict
MelonFire Community: Caching Web Sites With PEAR Cache
by Chris Cornutt November 21, 2006 @ 09:37:00
From the MelonFire community pages comes a new tutorial today talking about caching websites with a pre-existing PEAR package, PEAR_Cache.
More often than not, today's Web sites more closely resemble the big black truck crawling along the freeway than the little red Ferrari zipping through traffic. Fortunately, it's not all doom and gloom. By "caching" certain sections of your Web site, you can reduce the load on your server, significantly improve application response times and make your users happier.
They get down to the basics first, talking about what caching is and what it can do to help you and your application. This is quickly followed by some sample code to get the ball rolling, showing how to cache a simple string automatically. The next obvious step is to cache the contents of an entire dynamically generated file or automatically cache an entire application (without the need to do each file independently).
There's a few other examples they include as well - caching time, partial content, results from XML requests, and how to use a database to store your cached information.
voice your opinion now!
caching website file page pear cache package database tutorial caching website file page pear cache package database tutorial
Zend Developer Zone: Zend Framework Hidden Gems Introduction
by Chris Cornutt November 08, 2006 @ 15:36:00
Cal Evans, of the Zend Developer Zone, is taking a different path than the large number of Zend Framework tutorials that he's seen out there:
Zend Framework looked like an interesting platform, but each tutorial that I read started out with explaining how to set up your front controller, and moved form there into writing an entire application. I am not starting any new projects, and have no need for that.
Instead, he's chosen to look a bit "behind the scenes" at what really makes the Framework tick and why it would be a good choice for any number of web applications out there. It's going to become a series on the ZDZ, so he starts it off right with a comparison between PEAR and the Zend Framework, specifically when it comes to error handling.
It's more of a compare and contrast kind of thing than a contest, but it does seem that Cal favors one's approach a bit more. Which one? Well, you'll just have to go read and find out...
voice your opinion now!
zend framework hidden gem pear error handling exception simplicity zend framework hidden gem pear error handling exception simplicity
PHPKitchen: Advantages of using the PEAR class naming convention
by Chris Cornutt October 26, 2006 @ 07:51:00
Keeping with convention - well, naming convention - is a good thing sometimes. Demian Turner thinks so and talks about one of many reasons he sees to follow a standard set in place for a while now - the PEAR naming standard.
By far the most convincing reason to use the file naming convention, which means that a class located in your include path like Foo/Bar/Baz.php is called Foo_Bar_Baz, is the ability to take advantage of PHP 5's __autoload magic method.
The __autoload functionality in PHP 5 is definitely one of the most handy, elegant single lines of code out there and I'd definitely vote for anything that will make working with it even easier. Demian also includes a few lines of example code to show the interaction between the function and the files with the naming convention.
voice your opinion now!
pear class naming convention autoload simple reason pear class naming convention autoload simple reason
PHPBuilder.com: PEAR's HTML_QuickForm
by Chris Cornutt October 25, 2006 @ 14:29:00
PHPBuilder.com has posted a brand new tutorial today covering the installation and use of one of the most popular PEAR packages - HTML_QuickForm.
It makes handling the rendering and display of forms, and more usefully, both client and server-side validation, quick and easy. This article will take you through the basics of that package. It assumes familiarity with HTML form elements, and reasonably basic PHP skills.
Thanks to the PEAR installer, setting the package up on your machine is a snap. They also point out that you'll need the HTML_Common package to get things working. They move on to creating a simple form - showing how to add the elements and what the output looks like. There's even information on adding input validation (you do validate your input, don't you?) and doing a bit of formatting for the layout of the elements.
voice your opinion now!
pear package htmlquickform tutorial basic validation layout pear package htmlquickform tutorial basic validation layout
Greg Beaver's Blog: PhpDocumentor 1.3.1 is released
by Chris Cornutt October 25, 2006 @ 08:36:00
As Greg Beaver mentions, the latest version of the PHP documentation tool, PHPDocumentor has been released - version 1.3.1.
This release addresses a problem with the sourceforge release, as well as a few other minor bugs.
The phpDocumentor tool is a standalone auto-documentor similar to JavaDoc written in PHP. It differs from PHPDoc in that it is MUCH faster, parses a much wider range of php files, and comes with many customizations including 11 HTML templates, windows help file CHM output, PDF output, and XML DocBook peardoc2 output for use with documenting PEAR. In addition, it can do PHPXref source code highlighting and linking.
You can grab this download from either:
voice your opinion now!
phpdocumentor release sourceforge pear package download phpdocumentor release sourceforge pear package download
Dan Scott's Blog: Double-barreled PHP releases
by Chris Cornutt October 18, 2006 @ 09:21:00
Dan Scott posts some information about the "double-barreled PHP releases" hes made on his blog today. The two packages he's talking about are the Structures_LinkedList and the File_MARC PEAR packages.
I'm the proud parent of two new releases over the past couple of days: one official PEAR release for linked list fans, and another revision of the File_MARC proposal for library geeks.
For the Structures_LinkedList package, the update is a release of 0.1.0-alpha that he's quite happy with. Next up in the release cycle for this project is (if all goes well) 0.1.0-stable. He also mentions a problem he (and several from the IRC channel #php.pecl) worked through that ultimately lead to issues with the custom __destructor.
The File_MARC pakcage saw an update as well, with the new proposal version (0.0.9) being pushed into the PEAR Proposal process. It corrects a problem discovered at Hackfest with using file() to read in the lines of information (and it not scaling well). The solution was to go with the streams alternative, using stream_get_line.
voice your opinion now!
pear package release file_marc structures_linkedlist update pear package release file_marc structures_linkedlist update
Lukas Smith's Blog: Little status update
by Chris Cornutt October 16, 2006 @ 10:04:00
Along with a few personal comments, Lukas Smith has posted some thoughts about the state of everything PEAR following his stepping down from working as an active developer on the project.
I guess with me and Pierre leaving it did spawn a lot of energy about how to organize PEAR in the future. I am still participating in this discussion to some extent, mainly functioning as the historian who can explain why things are the way they are etc in order to prevent people from making rash decisions or even worse repeating old mistakes.
He also comments on the state of package submissions to PEAR, noting that some of them are just unrealistic and that it might be better to start a "PEAR2" side to allow for some of these more expanded ideas to flourish.
Instead I think each of the categories should manage itself more. So packages approval would be handled within the category. The same for QA'ing etc. This way new developers would not be facing this gigantic community. I think this is simply overwhelming. Even for old developers it becomes impossible to feel "at home" in a project of the size of PEAR.
voice your opinion now!
pear status update proposals pear2 repository project pear status update proposals pear2 repository project
Lorenzo Alberton's Blog: Navigation Through Paragraphs in an Article
by Chris Cornutt October 16, 2006 @ 08:53:00
Following the PEAR::Pager class theme, Lorenzo Alberton has posted another pagination tutorial today with a look at using the package to "paginate" through the paragraphs of an article quickly and easily.
Users often prefer reading short chunks of text instead of scrolling a very long page (unless they want to print the page, then the opposite applies). In this tutorial, we're going to see how we can build an article pagination system, with a little help from PEAR::Pager.
Lorenzo provides both the database structure and sample data to work off of as well as (obviously) the code to make it all happen. The script is pretty straight-forward, especially if you've looked through his previous tutorial using the same class. Since the paragraphs are broken up into different rows in the database, it makes it simple to pull them out just like the pages of the articles before.
He also includes some alternative navigation styles to help make things look a bit different - a drop-down, an article summary (of the sections), and a printer-friendly version.
voice your opinion now!
pagination pear pager package tutorial paragraphs pagination pear pager package tutorial paragraphs
Builder.com: Get the correct time by converting between time zones with PHP and PEAR
by Chris Cornutt October 10, 2006 @ 09:38:00
On the Builder.com website, there's a new tutorial demonstrating how to use the PEAR Date class to make switching between time zones a snap.
To be fair, PHP has built-in time zone functions to help with this, but these aren't particularly intuitive and require a fair amount of time to get used to. A quicker alternative is to use the PEAR Date class, which comes with built-in support for time zones and is, by far, the simplest way to perform these conversions.
This tutorial will teach you how to convert temporal values between time zones with the PEAR Date class. It assumes that you have a working Apache and PHP installation and that the PEAR Date class has been correctly installed.
They go with a few simple examples to introduce you to how things work:
- just taking in and echoing back out the date
- taking in the date and echoing it back out in a different format
- making a simple time zone conversion
- convert the timestamp to local time
- finding the offset for the time stamp from GMT
- adding and subtracting time stamps
all complete with the (simple) code to perform them all.
voice your opinion now!
pear date class time zone convert offset pear date class time zone convert offset
Lorenzo Alberton's Blog: DBMS and charsets, a summary and a call for help
by Chris Cornutt September 28, 2006 @ 08:15:00
On his blog today, Lorenzo Alberton Talks about DBMS and the character sets they support and issues a call for help for anyone interested to help them (on the PEAR::MDB2 project) set up proper character set support for each database.
We're working on PEAR::MDB2 charset and collation support. That means that we're in the process of figuring out what's the best way to set the charset in each DBMS, and how to make it portable and consistent through all of them.
I'll try to explain how the various DBMS implement charset settings first, then describe the MDB2 status-quo regarding charset support. Finally, we'd like to get some feedback to implement a better charset support in MDB2.
He lists out the types of character sets - client, connection, database/table/field, and result - explaining each of their roles in the average connection. He then breaks out the different databases into the different settings they support for the different character set types.
The call for help comes in with him asking anyone out there with experience and skill in these areas to get in touch and help out if they can. Contact information is in the post. You can also check out some of Lukas Smith's comments over on his blog too.
voice your opinion now!
database characterset summary callforhelp pear mdb2 database characterset summary callforhelp pear mdb2
Community News: Lead PEAR Developer Changes Focus
by Chris Cornutt September 27, 2006 @ 10:15:00
Today, Pierre-Alain Joye has fomally announced his "retirement" from working with the PEAR project as a lead developer. He's making a shift to work mainly towards other graphics/imaging work he's been developing and to continue work with his current extensions (and a few new ones on the way).
I spoke with him on some of the things that had lead up to making this decision and he mentioned it as a two-fold reason: one was some personal conflict between other PEAR developers and himself and the other an issue of time and interest in the project. He still wants to see it succeed, but just doesn't see the time in his life right now to do his part. Pierre will continue to work with the PECL extensions and on the PHP internals groups to help improve and develope them towards future versions. Some of the extensions he lists as the ones currently in his development are things like GD, xmlwriter, Zip (of course), and filter.
It is just a normal process, things and people change. I would have preferred a slower switch, as I was working on my leave (giving lead for many of my packages to other friends).
Pierre's PEAR work can be seen on this page of his blog and includes all of his PEAR and PECL work as well as PHP internals and Pimp/Cairo/GD development work.
You can also check out the decision in his own words over on his blog.
voice your opinion now!
pear pecl extensioon internal move pear pecl extensioon internal move
Lorenzo Alberton's Blog: PEARPager Tutorials
by Chris Cornutt September 19, 2006 @ 07:31:52
Lorenzo Alberton has posted a tutorial today about using teh PEAR::Pager package to create "pretty links" with a little help from mod_rewrite.
Most PHP pager classes can work just fine with GET parameters, correctly forwarding them through the pages. Few of them let you control the navigation links they create, though. This can be particularly annoying when you have some nice urls (thanks to some mod_rewrite rules o to your hand-crafted front controller) and the pager class can't respect them, showing the real, ugly links to the world.
If the above scenario is not new to you, then you should probably have a look at PEAR::Pager. It's a fully customizable package that should satisfy all your needs, including your preferred link format.
In his examples, he provides the mod_rewrite rules to use, a sample PHP script that would normally use the $_GET values (in an ugly URL) to paginate the results. He also compensates for if the page number is actually a part of the path and not just at the end of the file name.
voice your opinion now!
pear package pager tutorial mod_rewrite rules get page number pear package pager tutorial mod_rewrite rules get page number
PHPied.com: SAP container for PEARAuth
by Chris Cornutt September 07, 2006 @ 07:04:09
If you've ever wanted to quickly and easily connect your PHP script over to a SAP server to authenticate a user but weren't sure quite how, you'll be happy to see that you can use the PEAR::Auth package to make the request - with a little help.
PEAR::Auth is a package that allows you to abstract the user authentication from the main part of your application and not worry about it. What is good about the package is that it comes with different "containers" that allows you to authenticate users against different storages.
So I played around with creating an SAP container that allows you to check users against your company's SAP system and for example build a section of your Internet (or Extranet) page that is only accessible for people and partners that exist as users in the SAP system.
There's an extension to PHP you'll need to get and install, but with that in place, it's as simple as setting the authentication type to "SAP" and giving it the hostname to connect to. He also includes some sample scripts to get you started, including the Auth_Container_SAP class that makes the magic happen.
voice your opinion now!
sap container pear package auth extension class saprfc sap container pear package auth extension class saprfc
PHP-Tools Blog: Analyzing aide (advanced intrusion detection environment) output with PHP
by Chris Cornutt August 28, 2006 @ 07:28:19
Aide (Advanced Intrusion Detection Environment) is described as "a free replacement for Tripwire. It does the same things as the semi-free Tripwire and more." So, of course, one of the useful things that it does is output logs to help you keep track of what's happening on your system. In this new post on the PHP-Tools blog, they talk about the parsing of these same logs - with a little help from PHP.
Since we started hosting our sites on our own server we had some nasty cracker-attacks. To at least have a chance recognizing whether the system had been compromised we started to use aide some time ago. Aide keeps track of changes in the filesystem and provides us with a human-readable report once a day.
They note, though, that sometimes it's a valid change and not a security issue, so they employed the Util_AideAnalyzer package to help parse the logs into something useful. They give an example of what this looks like, including variations getting more specific data on certain aspects. They also point you in the right direction to get the Util_AideAnalyzer package installed on your system.
voice your opinion now!
aide system file monitor tool logs parse pear package util_aideanalyzer aide system file monitor tool logs parse pear package util_aideanalyzer
Lukas Smith's Blog: New PEAR releases
by Chris Cornutt August 22, 2006 @ 15:23:13
Lukas Smith has posted about some updates for the MDB2 PEAR package he maintains, including many bug fixes and the addition of the SQLite driver.
I got annoyed be seeing the driver fail so many of the unit tests because there is no support for ALTER TABLE in SQLite version 2 that I sat down and wrote up an emulation for it. Maybe someone has use for it.
There is a lot of tricky code in there to properly read the current table layout like fields, indexes and constraints as well as the data which all should be merged with the changes if everything goes as planned. Needless to say its a somewhat risky operation, especially since SQLite does not support transactions for DDL operaitons.
He also talks about some updates he's made to the LiveUser and LiveUser_Admin packages to correct bugs found there. His next release will be the MDB2_Schema package, with some new DML additions.
voice your opinion now!
pear release mdb2 mdb2_schema liveuser liveuser_admin sqlite pear release mdb2 mdb2_schema liveuser liveuser_admin sqlite
|