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

Fortrabbit.com:
Handle your dependencies with PHP composer
September 04, 2012 @ 12:02:31

If you've been developing any PHP at all recently, you've probably heard about the Composer package management tool that's caught on like wildfire in the community. If you're not currently using it, you might wonder what it's all about. Well, in this recent post on the Fortrabbit blog, Ulrich Kautz explains the tool and how to get started using it.

Composer describes itself as "a tool for dependency management in PHP". It uses a large repository of packages which is continuously extended and maintained by the community. It is now out there for about a year or so. This article goes out to everybody who is not already using it: we want you to give it a try it and here is why.

He talks about what Composer is (really a "dependency manager" more than a "package manager") and why its a good thing for projects to use. He gives the quick install instructions and an example of setting up a "composer.json" file to pull in the Twig templating and Doctrine ORM libraries. There's also a quick mention of including the Composer autoloader so it can find the resources correctly.

0 comments voice your opinion now!
composer handle dependencies tutorial introduction


Patrick Allaert's Blog:
Readable PHP code #2 - Make your API handle more!
May 28, 2010 @ 08:41:22

In a new post today Patrick Allaert has continued his "Readable Code" series with some tips on how you can make your API handle more.

His suggestions include:

  • Changing the handling to look for multiples by default
  • Avoiding inner looping (repeated looping) and try for code reuse
  • Transforming a scalar value into an array to make it easier to handle this way (by casting)
  • and how to handle objects in the same array-handling kind of code

He also tosses in a little mention of performance, noting that a call with range in the argument to his array-handling method is faster than looping over the same range and calling the method each time.

0 comments voice your opinion now!
readable api handle array object scalar tip


Digimantra.com:
Treat any file as PHP in Netbeans
January 28, 2010 @ 14:03:40

If you're a NetBeans user and have been frustrated by it's default handling of non-PHP extension files as PHP, you should check out this new post from Sachin Khosl on digimantra.com on how to fix the issue.

You love coding in Netbeans and you find it pretty uneasy when it does not function the way you want it to. That was the same with me when I started development in drupal and I was unable to associate the .module as PHP in my favorite editor Netbeans. However with little play around with options I was able to associate .module files as PHP file in Netbeans IDE. So for doing so follow [these] steps.

You can change the setting for plenty of different extensions (and add your own custom ones) in the Options under the Miscellaneous section's Files tab. Check out this screenshot to see the location.

0 comments voice your opinion now!
netbeans syntax handle options


Marco Tabini's Blog:
To except is human; to handle is divine.
April 23, 2009 @ 11:17:27

Marco Tabini has taken a different tack on error handling in his latest post. He suggests that developers need to spend a little less time trying to prevent so many errors and a little more time handling the ones that do happen.

When an error occurs, the vast majority of the web-based application code that I see during my reviews performs the software equivalent of running around with its head cut off: the developer spends an inordinate amount of time and resources trying to make the software look like what was essentially a catastrophic failure was nothing more than a small temporary hiccup.

[...] In reality, by the time an error has occurred, there are only two possible outcomes: either you expected the error to occur, in which case you have already written code to handle the failure, or you didn't, in which case your main focus should be to use the error as a learning opportunity.

Marco suggests alternatives to this usual worry and hysteria - spend more time ensuring that (if something does fail) there won't be any more damage, let the IT team know as soon as you find the issue and testing before you fix (reproduce the error before you dig in to try to fix it).

0 comments voice your opinion now!
test reproduce report timely damage prevent handle error


DevShed:
Adding CSS to Handling Views with CodeIgniter
March 27, 2009 @ 08:46:10

DevShed has posted the latest article in their "introduction to views in CodeIgniter" series - a look at working with the views to add more layout/design to them with CSS.

Now it's time to continue exploring the capabilities given by CodeIgniter when it comes to handling views. Since the visual appearance of the web page mentioned above was pretty rudimentary, in this second article I'm going to improve it a bit to make it look more appealing and professional.

To add in their CSS, they update their header_view.php file to includes the styles in the template. The views for each block are then loaded via the controller - header, content and footer areas.

0 comments voice your opinion now!
codeigniter handle views css tutorial header template


Chris Jones' Blog:
PHP OCI8 Signal Handling and --enable-sigchild
March 25, 2009 @ 10:22:51

Chris Jones has changed his stance on something he's been recommending PHP users compiling the OCI8 libraries into their installation - the use of enable-sigchild.

I am no longer blindly recommending using --enable-sigchild when configuring PHP with the OCI8 extension. I used to do this as a catch-all. It might have saved some users grief, and did little harm. With changes in recent versions of Oracle and my gut feel about common usage, it will be less confusing not to mention it as a general suggestion.

The point of using the compile flag was to help with the opening/closing of connections to Oracle server processes, but there's a better way he recommends now - using a "BEQUEATH_DETACH" option of "YES" in the sqlnet.ora/Apache config. If that doesn't work, then look into recompiling with the enable-sigchild option.

0 comments voice your opinion now!
oic8 oracle compile signal handle bequeathdetach recommendation


Jani Hartikainen's Blog:
Handling errors in Zend Framework
March 03, 2009 @ 07:54:59

Jani Hartikainen has written up a new post looking at error handling in one of the more popular PHP frameworks - the Zend Framework.

In Zend Framework based applications, error handling is typically done using the error controller, but there are different ways to send the execution to it - some better than others. Let's look at some ways to trigger the error controller and how to have it handle different error conditions.

He walks through the steps to create the Error controller, change the front controller to use it and add in a few different kinds of actions to handle the various error types that might come up (like "page not found" or "not authorized"). Errors can then be forwarded to each of the actions by the resource the visitor errored from. Of course, he also mentions that exceptions can do something even better - handle the error without all of that messy forwarding around. (There's an example of that version too).

0 comments voice your opinion now!
handle error controller zendframework exception forward action


Johannes Schluter's Blog:
Goto your Christmas presents with PHP 5.3
January 06, 2009 @ 10:20:56

Johannes Schluter recently looked at one of the new features coming with PHP 5.3 - the goto functionality:

Over the last few days I already mentioned a few hidden gems from PHP 5.3. Now at Christmas I wanted to take a look at some new language feature of the upcoming PHP version: Added "jump label" operator (limited "goto"). (Dmitry, Sara)

No, its not the sort of "goto" you're thinking of - its a bit more limited than that. Johannes mentions that it only allows you to jump within the same execution unit and you can't jump into loops. Used incorrectly, it can be bad but he points out two useful instances - one being a code generator and the other an instance where you might need to drop out of code but not kill off the script in the process (sample code is included for this second one).

0 comments voice your opinion now!
php5 goto new feature generate error handle


DevShed:
Null and Empty Strings
December 03, 2008 @ 11:16:51

On DevShed today, there's a new tutorial posted looking at two things that can cause headaches for PHP developers (especially when evaluating and comparing values) - nulls and empty strings.

Anyone who has programmed for any length of time has encountered the concepts of null and empty strings. They are not the same, and confusing the two can cause some serious problems. This article deals with these concepts in the context of PHP and MySQL.

They start with a bit of a quiz before getting into how to handle them correctly - making null "safe" and working with it correctly in a MySQL context. SQL statements and table structures are included for their examples.

0 comments voice your opinion now!
null empty string tutorial mysql handle safe


Chris Hartjes' Blog:
Handling Multiple Environments In Your PHP Application
November 28, 2008 @ 12:41:24

Chris Hartjes has posted his method for creating a development setup that lets you use multiple environments with your code.

In anticipation of my talk at PHP Quebec 2009 I've been going over my slides and thinking about what I'm going to update for it. One little nugget I'd thought I'd share is one way of handling having multiple environments your code must run in.

It uses a PHP variable in the $_SERVER superglobal - a custom one, APP_ENV - set by the application and checked to ensure global options are correctly set.

0 comments voice your opinion now!
handle multiple environment application multiple tutorial



Community Events





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


community podcast package interview laravel list release symfony api voicesoftheelephpant install tips library series framework opinion deployment bugfix language introduction

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