News Feed
Sections




News Archive
feed this:

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

Lorna Mitchell:
Using Composer in an Existing Project
August 20, 2013 @ 10:18:38

Lorna Mitchell has a recent post to her site showing you how to use Composer within an existing project that might not have the same Composer-expected structure. Composer is a package and dependency manager for PHP.

I've got an application (okay, scratty PHP script) which glues together some API things and shows them onto a dashboard for me. Recently, I updated it to use Guzzle as the consuming client, since twitter now needs me to authenticate (I wrote about that if you're interested), and I used Composer to bring the new library in. It was very simple so I thought I'd share it as it's quite minimal example, and those are my favourite kind.

She includes a brief "getting started" for those not already familiar with Composer and shows a sample composer.json file that pulls in the Guzzle HTTP library. Then calling the "install" with Composer pulls in the files in the right place and all you have to do is add the needed require_once include to your autoloading process. Composer handles the rest.

0 comments voice your opinion now!
composer existing project guzzle install introduction requireonce

Link: http://www.lornajane.net/posts/2013/using-composer-in-an-existing-project

Phil Sturgeon's Blog:
Why Write A New Framework?
April 11, 2011 @ 11:30:37

Phil Sturgeon, a developer on the Fuel framework project, has a new post to his blog asking a common question of all developers that set out to make the "Next Big Framework" - why write a new framework?

So we all know that the internet is full of frameworks. They've been the popular thing for the last 5 or 6 years and it seems to have become the "barrier for entry" or the "passage of rights" that 8 or 9 years ago used to be "hey I just wrote a phpBB clone!". There are plenty around but in this day in age, why would anyone write a new one? As somebody involved in a new PHP framework - Fuel - that has shaken a few opinions up I thought it would be interesting to share my thoughts and views on the situation.

While he agrees that there are plenty of other frameworks out there, maybe too many to choose from, he thinks that there's value in making something that's useful to you and the toolsets you're already used to. One of their goals with Fuel is to "make PHP as fun to use" as possible and things like built-in migrations and scaffolding (along with a command-line tool, Oil) help towards that goal.

A framework is essentially a way to put all of your best practises into a single place so that you can reuse them over and over again. This should make you more efficient and make your time more financially viable to clients. If the framework you use slows you down or does not cater for the way you like to develop then sack it off and do your own thing.
0 comments voice your opinion now!
opinion fuelphp framework new existing reinventthewheel useful


Mike Lively's Blog:
Adding Database Tests to Existing PHPUnit Test Cases
September 05, 2007 @ 10:50:30

Mike Lively has posted about functionality he's created to add database testing procedures to preexisting PHPUnit tests supplementing his other post n adding database support to PHPUnit.

When I was first creating the Database Extension for PHPUnit I realized that there was a very high likelihood that several people would have tests that were already written that they would like to add additional database tests too. To accomplish this I actually wrote the PHPUnit_Extensions_Database_DefaultTester class. In fact, if you were to look at the source of the database test case you will see that all of it's operations are actually forwarded to this class which does all of the work.

He includes his same example from before - the banking system - and shows how the tests can be appended on, adding a getDatabaseTester method that returns an object the rest of the tests can use.

0 comments voice your opinion now!
database test phpunit unittest existing case database test phpunit unittest existing case


DevShed:
Creating Image Streams from Existing Graphics with the GD Library in PHP
August 20, 2007 @ 11:04:00

DevShed continues its look at using the GD graphics library in PHP with the second part of the tutorial series, this time focusing on the creation of images from existing images (and their streams).

As I stated at the end of the previous article of this series, the GD extension comes packaged with many other useful functions, which indeed deserve a close and detailed look. Thus, in this second tutorial I'll show you how to create different types of image streams from existing graphics, but in this case limiting the process to building GIF, JPG and PNG images.

They work through each of the types (GIF, JPG and PNG) creating an new one from a previous "clouds" image of the same type (a GIF out of a GIF, a JPG from a JPG, etc).

0 comments voice your opinion now!
tutorial gd graphic create stream png jpg gif existing tutorial gd graphic create stream png jpg gif existing


Soledad Pendaes' Blog:
PHP will never have a (real) Rails-like framework
January 31, 2007 @ 09:15:00

Well, according to Soledad Pendaes, PHP will never have a (real) Rails-like framework because of some of the limitations with objects inherent to the language.

I know the title is harsh but it's so true. At least it is according to nowadays php's implementation of classes and objects, which do not permit to "reopen" and add or redefine new methods to an existing class definition, which is the basis upon Rails (and I presume lots more of applications and frameworks) is built.

The post goes on to talk about they "why" behind the statement - basically that this kind of functionality makes it easier to "Extend. Morph. Adapt. Improve. Refine." your applications. She talks some about other frameworks that have tried to offer the same kinds of functionality Rails does (CakePHP and Symfony) but notes that they still have their limitations (in specific, mentioning CakePHP's AppModel functionality).

3 comments voice your opinion now!
rails framework redefine existing class php5 cakephp symfony rails framework redefine existing class php5 cakephp symfony


Stoyan Stefanov's Blog:
Reusing an existing database connection with MDB2
January 08, 2007 @ 12:33:00

In this new blog post, Stoyan Stefanov shares a method he's found to reuse an existing database connection with the MDB2 library.

This is a follow up to a question posted by Sam in my DB-2-MDB2 post. The question was if you can reuse an exisitng database connection you've already established and not have MDB2 creating a second connection.

He gives two different methods, one for persistent connections and the other for non-persistent ones - including some code.

0 comments voice your opinion now!
mdb2 reuse connection persistent database method existing mdb2 reuse connection persistent database method existing


Andi Gutmans' Blog:
PHP 5 Adoption has Tipped!
July 17, 2006 @ 05:45:19

According to this new post on Andi Gutmans' blog today, the adoption of PHP versions seems to be tipping in favor of PHP5.

PHP 5 was released in July 2004. Since its release two years ago, there has been a lot of talk about its adoption rate and whether it will surpass the PHP 4 installed base. No doubt that it will still take some time for PHP 5 to reach PHP 4's existing installed base. The main reason for this are the numerous PHP 4-based applications that were built over the years, and if it's not broken, don't fix it.

He includes a graph showing the adoption of both PHP4 and PHP5 versions, noting a large increase from the release of the 5.1 version of PHP.

Although I knew many were waiting for PHP 5.1 before upgrading, its release in last November seems to have created a huge increase in PHP 5 adoption. In July over 74% of support tickets were by customers using PHP 5 (and remember we do support both versions).
0 comments voice your opinion now!
adoption rate php5 php4 existing applications graph adoption rate php5 php4 existing applications graph



Community Events





Don't see your event here?
Let us know!


introduction wordpress language testing interview install refactor podcast laravel configure series list threedevsandamaybe code opinion release developer unittest framework community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework