PHP Community

Installing PHP on Oracle HTTP Server 12c

Planet-PHP - do, 24/04/2014 - 22:30

OTN have posted an updated guide for installing PHP on Oracle HTTP Server. Check it out!

Using PHP-FPM is a great way to integrate with Oracle Fusion Middleware.

Categorieën: Open Source, PHP Community

php[architect]: April 2014 Issue Released - Major Players

PHPDeveloper.org - do, 24/04/2014 - 18:56

As is mentioned on the php[architect] site today, they've released their latest issue - the April 2014 edition, Major Players.

It's spring, and (here in the U.S.) the Majors are starting up! In sports, we all have our favorites- the ones we love, and the ones we love to hate. In PHP, we have the similar players- Drupal, WordPress, and Yii Framework (to name a few). Love them or hate them, you can't deny that they're Major Players!

Articles in this latest edition cover topics like:

  • Programmatically Control Drupal
  • Get Started with Joind.in
  • Advanced Authentication in Laravel
  • Fly with Phalcon

You can pick up your copy directly from the php[architect] website or you can always subscribe (with both digital and print options) for a full year.

Link: http://www.phparch.com/2014/04/april-2014-phparchitect-magazine-released-major-players/

Politics Often Hold the Community Back

Planet-PHP - do, 24/04/2014 - 18:00

In this part of the interview series, I’m interviewing this channel’s editor, Bruno Škvorc, along with the feedback from Gary Hockin from Roave. We’ll start with Gary.

Gary Hockin
What lead you to PHP?

Simply, classic ASP. I was working as a general dogsbody in a huge steelworks in Port Talbot, and we were paying thousands of pounds for licenses, to display data from an Oracle database on lots of screens.

I started looking into ways of displaying that data on multiple screens for free - each machine had IE6 (at the time) so I explored ASP.

From there I realised that I loved the role of web development and quickly learned PHP in my own time, as I realised then that open source was where the future was.

What have been the things about PHP that bit you?

In a positive way, originally it’s the fact that you can create these amazing interactive webpages which you can push to a $10 shared host and point your friends to it to play with.

When I was a “kid” that was what kept me coming back to messing around with PHP, and ultimately why I shifted my career around it. More recently it’s the community. The community is simply amazing.

What have been the highlights or redeeming features

Of my career in PHP? I touched on it early, the community has been truly an epiphany for me. About 5 years ago I was sitting around as a Ghost Developer (http://www.troyhunt.com/2013/02/the-ghost-who-codes-how-anonymity-is.html), working in semi-object-oriented PHP, when I suddenly realised that someone HAD to have created a standard framework for building PHP applications.

A quick Google led me to a list as long as your arm, but because we were already using Zend Guard on distributed servers I decided to use Zend Framework (1). From there I found the #zftalk IRC channel, and from there I got totally immersed in the ZF community.

Continue reading %Politics Often Hold the Community Back%

Categorieën: Open Source, PHP Community

PHPMaster.com: PHP News You May Have Missed

PHPDeveloper.org - do, 24/04/2014 - 17:30

PHPMaster.com has posted some news you might have missed that's happened in the development and open source communities recently. In the post Bruno Skvorc covers updates to projects, resources and various online tools/environments related to PHP.

The last month or two have been chock full of small news and releases not warranting a full story in their own right but still interesting, I've decided to make a small compilation and direct your attention to the interesting developments around us. Just because we don't cover something immediately, doesn't mean we don't notice or care.

Included in the post are updates about:

  • Ubuntu 14.04. LTS
  • Google App Engine 1.9.1 - 1.9.3
  • Hack
  • Phalcon 2 beta 1
  • the Zend Framework 2 Certified Architect certification
  • Zend Framework 3 Progress

...and several more. Check out the full post for more information on these and several other recent happenings around the web.

Link: http://www.sitepoint.com/news-may-missed

Master Zend Framework: Running the ZF2Skeleton with PHP's Built-in Webserver

PHPDeveloper.org - do, 24/04/2014 - 16:25

The Master Zend Framework site has posted the first in their screencast series with a look at running the ZF2Skeleton with PHP's built-in webserver.

In this screencast we'll go through the creating an application from the ZF2Skeleton project on Github and getting it up and running, using PHP's built-in web server. [It requires] PHP 5.4 or higher and Curl.

The screencast, coming in just over 3 minutes, briefly introduces you to the ZF2Skeleton project and shows you how to run it as a single process though PHP's own web server (useful for debugging). As a part of the installation, he also helps you get Composer installed as that's what Zend Framework 2 uses to install its packages correctly.

Link: http://www.masterzendframework.com/casts/001

Community News: Packagist Latest Releases for 04.24.2014

PHPDeveloper.org - do, 24/04/2014 - 15:07
Recent releases from the Packagist:

PHP News You May Have Missed

Planet-PHP - wo, 23/04/2014 - 18:00

The last month or two have been chock full of small news and releases not warranting a full story in their own right but still interesting, I’ve decided to make a small compilation and direct your attention to the interesting developments around us. Just because we don’t cover something immediately, doesn’t mean we don’t notice or care :)

Ubuntu 14.04. LTS

enter image description here

Not so much PHP related, but still fairly important for our channel and future development purposes, the release of Ubuntu Server 14.04 LTS kind of flew by most people. This release will be supported by Canonical until 2019, which is a big deal as we can now all switch to this newest version as soon as it’s vetted by hardcore users. Stay tuned for upcoming Vagrant boxes predefined for 14.04. soon - we’ll be custom building and publishing some soon.

You can download the server version here and there’s a default Vagrant box available here.

GAE 1.9.1 - 1.9.3

enter image description here

Google App Engine has reached minor version 1.9.3., adding some more features and upgrades since the last time we talked about it:

  • bug fixes regarding Zend Framework, null characters in URLFetch, failed file uploads to Cloud Storage, long POST data, unlimited upload sizes and the fnmatch() function
  • ability to embed images in emails via the Content-Id header was added
  • the zip module is included by default now

The SDK has been updated and you can take it for a spin immediately. To see how you can do that, check out my previous article on GAE.

Continue reading %PHP News You May Have Missed%

Categorieën: Open Source, PHP Community

Rob Allen: Injecting dependencies into your ZF2 controllers

PHPDeveloper.org - wo, 23/04/2014 - 16:06

Rob Allen has a quick new post to his site showing you how to inject dependencies into controllers in a Zend Framework v2 based application.

When starting working with Zend Framework 2, it's common to copy the skeleton and put your controller definitions in module.config.php. The controllers keyword is picked up by the ControllerManager which is an instance of the ServiceManager which means that it creates the controller instance for you when the dispatcher needs it. As it's just a service manager, we configure it to inject the dependencies that the controller needs rather than having to go fishing for them later.

He shows how to write a "getControllerConfig" method to populate two items into the factory call for a "Blog" controller, blog mapper and content mapper classes. He also includes a reminder that ZF2 controllers have no constructor, so dependencies can be more easily injected and used directly in the class.

Link: http://akrabat.com/zend-framework-2/injecting-dependencies-into-your-zf2-controllers/

Community News: Packagist Latest Releases for 04.23.2014

PHPDeveloper.org - wo, 23/04/2014 - 15:09
Recent releases from the Packagist:

Unit testing is dead? Hardly.

Planet-PHP - wo, 23/04/2014 - 14:09

Despite what His Majesty, David Heinemeier Hansson may have said, unit testing is by no means dead. And, in fact, system testing is no more a complete testing strategy than 100% test coverage with unit tests. Let me explain.

Test Driven Development (TDD) is a philosophy that asserts testing is so important that the tests should be written first, to emphasize the design of the code. The idea is that by writing a failing test, and then writing code that passes that test, you end up with an overall better architecture.

Of course, TDD has some flaws: namely it’s a “write to the tests” design strategy that, while potentially encouraging better design, can potentially harm your overall design by removing “big picture thinking.”

The problem is, DHH has basically said TDD is worthless, and system testing, not unit testing, is the way to go. And yet, this philosophy has just as many blind spots as TDD does.

Socorro used an “integration test” methodology to accomplish the majority of it’s testing. And while this worked well to avoid regressions in many cases, it also had many holes. One such hole that frustrated me was the complete lack of tests for the stored procedures in the database: I would write a stored procedure, and a middleware to access the results, but because the stored procedure created data on a cron cycle, there was no way to validate it automatically. You can guess which parts of my code often broke on staging.

Of course, system testing has a place alongside unit testing. System testing ensures a high-level assessment of the overall application, and ensures that we are getting the right answer at a high level. It makes sure that all our components come together and do their jobs. Unit tests won’t catch failed or missing database migrations, or Javascript bugs.

Unit testing, on the other hand, provides an opportunity for us to get nitty-gritty and to test specific avenues of our code for accuracy and effectiveness. Unlike a system test, a well-written failed unit test points right to the source of the problem, making it easier to correct. A system test will tell you that the system is broken, but you have to hunt for the cause.

By all means, we should be writing more, not fewer, tests. And we should be testing whole systems as well as specific units of code. Testing is not an either-or situation whereby we can only do one or the other.

Categorieën: Open Source, PHP Community

Walking the London LOOP - part 9

Derick Rethans - wo, 23/04/2014 - 10:14
Walking the London LOOP - part 9

Due to abysmal weather, we moved our walk to Monday this weekend. That was not much of a problem as it was Easter Monday.

loop9-d36_5167.jpg

We traveled back to Kingston and crossed the bridge over the Thames. Just before entering Bushy Park, we passed a perculiar few trees... they had loads of shoes in them! All a similar style as well. The first part through Bushy Park were open fields, and a few ponds with birds nesting in the reeds around it.

loop9-d36_5185.jpg

After a while we crossed a road and ended up at the Woodland Gardens. They consist of two plantations, the Pheasentry Plantation and the Waterhouse Plantation. We had a few issues finding the entrance to the first one, as they had slightly changed the gates. Of course, I have now fixed that in OpenStreetMap. Both "Plantations" are quite different. The first one has more open spaces where the second one is much more dense woodland. In both plantations, everything was very much in bloom.

When leaving the plantations we proceeded through Bushy Park and went the wrong way. That wasn't really bad, as we ended up at the Water Gardens, which only recently opened the public.

After Bushy Park we were a bit thirsty and made a little detour to find a pub, The Windmill. The original idea was to have a quick meal there as well, but the menu was limited and the bar staff rather grumpy. We just stuck around for a pint, and made another detour to find lunch—the local Sainsbury's.

After picking up lunch we followed a few residential streets and found the Crane River, past which we would walk for almost all of the rest of the walk.

loop9-d36_5201.jpg

The park near the river had some good walking paths and it was also the place where we enjoyed our bought sandwiches, crisps and drinks on a bench, in the sun, with flocks of parakeets and airlines flying over.

loop9-d36_5206.jpg

After a while we came upon the Shot Tower, where they previously made "shot" for guns. Near the Shot Tower is also the entrance to the Crane Park Nature Reserve which we probably should have visited as well, but didn't.

After another small stretch of road, we entered Hounslow Heath and from there on we continued through Brazil Mill Woods, Donkey Wood and the Causeway all the way to the Great South West Road. I think we were lucky that it was a Sunday, as there was nearly no traffic.

loop9-d36_5214.jpg

The end of the walk was at Hatton Cross station, near the end of Heathrow's runway 09R/27L. You would probably not be surprised that many planes flew over!

The weather was warm with 16-18°C, but also muggy. We were a lot sweatier than on previous walks.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

Categorieën: Open Source, PHP Community

Master Zend Framework: Howto Handle External Form Element Dependencies with FormElementManager

PHPDeveloper.org - di, 22/04/2014 - 18:58

The Master Zend Framework site has posted a tutorial wanting to help you understand external form element dependencies with help from FormElementManager.

Zend Framework 2, like all great PHP frameworks, provides thorough infrastructure for creating forms in your application. Whether that's form objects, form elements, fieldsets, validation groups or that they interact with so many other components in the Zend Framework 2 default libraries. But how do you handle external dependencies? [...] So what if you need a custom form element in your application, one which will render a list of articles from a database table? [...] In today's post, we're going to look at how to create such a custom element, extending the existing select element.

He walks you through the steps you'll need to make the custom element and hook it into the FormElementManager for correct use:

  • Create a New Form Element
  • Implement the getFormElementConfig Method
  • Create a New Form Object
  • Instantiate the Form Via the FormElementManager

Code is included for each step of the way so you can ensure you end up with a working example.

Link: http://www.masterzendframework.com/zend-form/handle-external-form-element-dependencies-with-formelementmanager

SitePoint PHP Blog: Database Versioning with Ladder Migrations

PHPDeveloper.org - di, 22/04/2014 - 17:48

The SitePoint PHP blog has posted another tutorial looking at database versioning (see this postfocusing on Ladder migrations. Ladder is a simple PHP-based way to write migrations with rollbacks in a clear, easy to read format.

Version control systems are invaluable for tracking changes in your code, particularly when you're working in a team. However, most applications don't consist solely of application code. Managing changes to the database has always been a little more challenging, particularly when you're adding new features which require changes to the schema. [...] One solution is to move responsibility for creating and modifying the database schema into code, using migrations. That way, changes can be managed along with the rest of your application, and features we take for granted in version control - such as being able to compare versions and keep an audit trail - can be used for database changes.

He introduces the Ladder tool briefly, shows how to get it installed/configured and gets into writing a first simple migration. It creates a "users" table with two columns and comes with both "up" and "down" methods to make rollbacks easier. Ladder also provides functionality for database seeding, pre-populating the database tables with sample data either from hard-coded values or from a CVS file.

Link: http://www.sitepoint.com/database-versioning-ladder-migrations

HipHop VM Blog: Compatibility Update

PHPDeveloper.org - di, 22/04/2014 - 16:16

The HipHop VM blog has a new post today with some updates around the compatibility work they're doing getting popular PHP projects to work 100% on the platform (and have all unit tests pass).

Earlier this year we set an ambitious goal of passing the PHPUnit test suites of 20 popular frameworks by the end of June; at the time, we were passing on only 6! With a huge amount of help from the community (especially our OpenAcademy students), we're proud to have hit this goal more than 2 months early, and we have more frameworks expected to reach 100% shortly.

Included in their list of projects/frameworks are things like Assetic, Composer, Doctrine2, Guzzle (v3), Laravel, Mockery and Monolog. Now that they've made significant strides to get the HHVM up to a greater level of compatibility, they're going to focus in on the issues list from GitHub to resolve problems there.

Link: http://hhvm.com/blog/4841/compatibility-update

Community News: Packagist Latest Releases for 04.22.2014

PHPDeveloper.org - di, 22/04/2014 - 15:02
Recent releases from the Packagist:

Community News: Latest PECL Releases for 04.22.2014

PHPDeveloper.org - di, 22/04/2014 - 14:07
Latest PECL Releases:
  • opengl 0.8.0 - Initial PECL package release.

  • hrtime 0.4.3 - first public release

  • riak 1.1.5 Since 1.1.4 New: Object now allows contentEncoding, contentType, content and vTag to be set to NULL. Fixes issue 72: Riak HTTP stops working after update

  • swoole 1.7.0 - Fixed compile error.

  • protocolbuffers 0.2.6 Bumped up to 0.2.6 * fixed several compile warnings (thanks remi) [fixes] * (ExtensionRegistry) initialize class entry member when reallocating scheme.

WeCamp: Everybody is welcome!

Planet-PHP - di, 22/04/2014 - 13:06

Last month we announced WeCamp, an event where developers can improve their skills not just by listening to people, but also by actually doing things. Response has been amazing: Many people love the idea, we’ve already sold quite a few tickets, and we’ve even got Magma giving a ticket as a price (At the time of publishing of this blogpost there’s only a couple of hours left, so if you want to win, be fast!). Since announcing the event, I’ve talked to several different people who had the same doubt/question about the event, so I thought I’d clarify things a bit more.

Who should come to WeCamp?

Everyone! We don’t want to exclude anyone and we actually think everyone would be a huge asset to the event. I’ve had people say “I’m not experienced enough in development to attend”, to which I could only respond “untrue!”. The idea of WeCamp is that you don’t just train your technical skills but also your social skills. For a less experienced developer, the practical experience of working in a team with more experienced developers is priceless. In that same team, however, the most experienced developer gets the additional experience of helping a less experienced developer with the work, gaining a lot of experience and knowledge on how you can help others. This social aspect is easily just as important as gaining technical skills. So both developers come out of this gaining experience.

But I’m a frontend developer…

So? If you’re a frontend developer, have a look at the many websites created by pure backend developers… do they look good? Are they accessible? Built according to W3C standards? Most probably not. You’re needed! While we have a focus on PHP, you’ll learn to work with PHP developers: How to communicate with them, how they look at frontend work, what tools are available in the PHP ecosystem for frontend. And I know this may sound scary, but you’d perhaps even get some PHP skills as well.

Additionally: WeCamp is not just about technology. We’ll go through all stages of a project, starting at thinking of a good idea through planning to development, deployment and perhaps even marketing! There’s more than enough to learn throughout this whole process.

But I wonder about…

If you have any more doubts or questions, please let us know! This is the first time we’re organizing WeCamp so we’re still very much looking for what works best with a lot of things. If there’s any unclarity, or you have comments for improvements, let us know! You can always tweet at us @wecamp14 but you can also shoot us an email: we-can@weca.mp. We’re also here to learn, so please help us do just that!

Categorieën: Open Source, PHP Community

Meet Composer, your new autoloader

Planet-PHP - di, 22/04/2014 - 13:00

Most PHP developers are familiar with Composer’s power as a package manager, and it’s ability to autoload all the packages it downloads. But what fewer PHP developers know about or use is Composer’s ability to load your code automatically, too.

In fact, developers can use Composer’s autoloader to autoload their own code, even if they don’t use one of the PSR standards for namespacing and path construction.

Using Composer with PSR-0 or PSR-4 for your own code

If you already apply either PSR-0 or PSR-4 to your own code, you can make use of Composer with relative ease. If you’re using PSR-0, you only have to give Composer the path and the namespace, like this:

    "autoload": {
        "psr-0" : {
            "Application": "src/"
        }
    }

The key tells Composer that all Application\ namespaced code iwll live in the src/ directory; PSR-0 expects that there will be an Application/ directory inside the src/ directory to contain all the code, too.

For developers who have upgraded to PSR-4, it’s as simple as making two small changes: switching the psr-0 to psr-4, and identifying the fully qualified namespace for the directory:

    "autoload": {
        "psr-4" : {
            "Application\\": "src/"
        }
    }
Using Composer for non-PSR-compliant applications

Legacy code often doesn’t follow the current PSR standards, and developers may find it impractical to switch. But that doesn’t mean that you can’t use Composer to autoload your code. In fact, with classmaps you can.

A classmap is a Composer feature that iterates through a directory and pulls the classes out of the files in that directory, and adds them to a classmap. Even though the application I’m using as an example implements PSR-0, we can still generate a classmap:

    "autoload": {
        "classmap" : [
            "src/"
        ]
    }

This produces a classmap that looks something like this:

<?php

// autoload_classmap.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Application\\Controller\\Dashboard' => $baseDir . '/src/Application/Controller/Dashboard.php',
    'Application\\Controller\\Defaults' => $baseDir . '/src/Application/Controller/Defaults.php',
    'Application\\Controller\\Entry' => $baseDir . '/src/Application/Controller/Entry.php',
    'Application\\Controller\\Logbook' => $baseDir . '/src/Application/Controller/Logbook.php',
    'Application\\Controller\\RequiresAuth' => $baseDir . '/src/Application/Controller/RequiresAuth.php',
    'Application\\Controller\\User' => $baseDir . '/src/Application/Controller/User.php',
    'Application\\Model\\LogEntry\\Defaults' => $baseDir . '/src/Application/Model/LogEntry/Defaults.php',
    'Application\\Model\\LogEntry\\Gateway' => $baseDir . '/src/Application/Model/LogEntry/Gateway.php',
    'Application\\Model\\LogEntry\\HourReports' => $baseDir . '/src/Application/Model/LogEntry/HourReports.php',
    'Application\\Model\\LogEntry\\LogEntry' => $baseDir . '/src/Application/Model/LogEntry/LogEntry.php',
    'Application\\Model\\LogEntry\\LogEntryCollection' => $baseDir . '/src/Application/Model/LogEntry/LogEntryCollection.php',
    'Application\\Model\\LogEntry\\Storage' => $baseDir . '/src/Application/Model/LogEntry/Storage.php',
    'Application\\Model\\User\\Gateway' => $baseDir . '/src/Application/Model/User/Gateway.php',
    'Application\\Model\\User\\Storage' => $baseDir . '/src/Application/Model/User/Storage.php',
    'Application\\Model\\User\\User' => $baseDir . '/src/Application/Model/User/User.php',
    / ...
);

This has some definite advantages for projects that are still stuck in legacy mode: the ability to autoload classes automatically, without rewriting massive amounts of the application. Though there is also a significant drawback: unlike PSR-0 or PSR-4, the classmap has to be updated every time a file is renamed or a new class is added. This can be avoided by using the classmap only for legacy classes, and writing new classes to be compatible with a PSR standard.

The bottom line

You don’t have to maintain your own autoloader or rely on outdated technology to keep autoloading your files. Composer offers a great number of options built into a tool you’re probably already using anyway. Give it a shot!

Categorieën: Open Source, PHP Community
Inhoud syndiceren