A few people have told me it's their New Year's resolution to become a ZCE this year, and I'm sure they're not the only ones. I regularly help developers and teams prepare for ZCE, so I thought I'd make up a mini package of tips, tricks and a full set sample questions with solutions and explanations, for anyone who won't be taking a whole preparation course. The package costs 25 USD (that's about 15 quid if you're local!), you can click on the button below to buy it, and/or keep reading for some of the tips (also included in the package).
This post forms part of a series of articles about using PHP to do objected oriented programming, or OOP. They were originally published elsewhere but are no longer available at that location, so I'm reposting them here. Previously in the series was an introduction to OOP in PHP, in two parts
The title is a bit of a red herring as PHP has more than 9 magic methods, but these will get you off to a good start using PHP's magic methods. It might be magic, but no wands are required!
My shiny new VPS* runs Ubuntu 12.10 (official subtitle: Quantal Queztal. Local nickname: Quirky Kestrel) and therefore has PHP 5.4 installed. It's very new so every command I type is missing, and today I realised that included a PECL module (pecl_http, of course). So I
aptitude install php5-pear and then get tangled in dev packages (clue: look which libcurl you have already installed to figure out which of a long list of
-dev packages to choose), managing finally to emerge with a
pecl install http that completes successfully with the words:
configuration option "php_ini" is not set to php.ini location
You should add "extension=http.so" to php.ini
I've been using Ubuntu for some time however, and we don't put settings straight into
php.ini, there's a directory called
/etc/php5/conf.d/ where all the various module configurations live, or you can enable things just for when PHP is called by apache or from the CLI. However today I hopped into
/etc/php5/ and saw this:
mods-available ? Continue reading
This post forms part of a series of articles about using PHP to do objected oriented programming, or OOP. They were originally published elsewhere but are no longer available at that location, so I'm reposting them here.
This post follows an earlier entry introducing the basics OOP and what that looks like in PHP. This time around we'll look at some more advanced concepts and some more practical examples of building code, covering use of constructors and how to add access modifiers in to control how calling code can operate on your objects. We'll also show off how to create static methods and properties and, perhaps more importantly, illustrate applications of these features.
There's an excellent open source conference that happens every year in Brussels in February, called FOSDEM. It consists of some main tracks, plus a series of sub-rooms, where various technical communities are given some space to use for whichever talks they choose; the schedules are centralised so that people can pop in and visit any talks in any room that looks interesting. This year, for the first time, this includes a "PHP and Friends" room - I'll be organising this and I'm looking for your input, please.
Basically, we need to get some great submissions, so that when we come to choose the schedule (and it is only one track, one day, there's only a few slots available), we can put together something really fitting to showcase PHP for a wider audience than a PHP conference. Selection will be done on the basis of talk topic, abstract and length in the first instance - we'll only take into account the actual speakers when we're curating the final list.
Key things you need to know:
- link to call for papers form (google forms)
- Event is 2nd (and 3rd, but the PHP room is on the 2nd) of February 2013, at ULB campus Solbosh in Brussels, Belgium
- No expenses will be covered by the event
- There's also a Call for Stands if you have a project that you would like to represent there
- If you're not speaking, come and join us anyway!
This is the first in a series of articles about using PHP to do objected oriented programming, or OOP. They were originally published elsewhere but are no longer available at that location, so I'm reposting them here.
Since the introduction of PHP 5 in 2004, PHP has had an object model worthy of that description and became a truly modern language for use on the web. Earlier PHP scripts would have been of the kind where, to quote from Alice's Adventures, you would "Begin at the beginning, and go on till you come to the end: then stop." Nowadays that very procedural approach is less common in PHP, so this article takes a look at some of the basic object oriented features available in the language and shows some examples of using them with code examples.
While I'm in the US in a week or so, I'll be joining a stellar lineup at Confident Coding on October 20th in San Francisco. This is a by-women, for-women event to let us get together in a safe space where there are no stupid questions, and try to cover those tricks that it seems like everyone knows, but we all had to learn sometime!
Personally I'll be speaking about git and also about SSH and things that are not FTP, and anything else I get asked about on the day. The variety of skills in the speaker lineup of this event, organised by the lovely @estellevw, is frankly imporessive and I can't wait to meet all the speakers and attendees! I'm not often in the US at all (I'm a very reluctant traveller and I'm actually there for ZendCon the week after) so this is a rare opportunity for me.
The event is open to everyone, but if you don't identify as female and you want to attend, please bring with you someone who does - and either way you can make use of my discount code! Simply buy a ticket, entering LORNA20 at the checkout for 20% off the ticket price.
Hope to see you there :)
This spring Emma Jane and Lorna Jane were chatting about PHP and Drupal and workshops and came to the conclusion that Drupal developers were not necessarily equipped for Drupal 8. With all of the Drupalisms in the Drupal code, it can sometimes be difficult to implement code that is both a Drupal best practice and a PHP best practice. While there are many workshops on how to teach PHP developers how to Drupal, there were no workshops teaching Drupal developers how to PHP. Until now!
My theory is that most developers working with CMSes like Drupal think they don't know much PHP ... but of course they actually know quite a lot! The newer versions make more use of OOP and new PHP features, but nothing that's really rocket science (although the symfony components are very nice). This course is a chance for us to give a more solid grounding to those skills that developers just pick up along the way, and give some time to master those skills in a safe environment. Continue reading
This post is mostly about a tutorial I will be delivering at PHPNW on October 5th in Manchester, UK, and why I think a tutorial that contains no PHP belongs at a PHP conference
In October, I'll be delivering a tutorial at the mighty PHPNW Conference which contains very little PHP. Why? Because I think, as developers, it's our other professional skills that suffer. As a consultant, I work with lots of different teams, and it is very rare for code to be the problem (and the one time it was, it wasn't the only problem!).
In web development, our biggest challenges are not writing code, we can do that. But getting the code safely from one place to another, with many people's work preserved, having our platform(s) correctly configured and understanding how to use them, making use of the tools in the ecosystem which will help us improve the quality of our code; these are the big challenges we face, and that's why I proposed this workshop and why I think all these topics are important. Continue reading
A very quick snippet today because I've told two people to use this approach in the last few days and both of them told me they didn't know about it. How to check if an email address is valid in PHP: use one of the Filter functions, like this:
$email1 = "nonsense.something@dottiness"; // not a valid email $email2 = "firstname.lastname@example.org"; // valid email $clean_email1 = filter_var($email1, FILTER_VALIDATE_EMAIL); // $clean_email1 = false $clean_email2 = filter_var($email2, FILTER_VALIDATE_EMAIL); // $clean_email2 = email@example.com
The Filter extension was new in PHP 5.2, but is one of the unsung heroes of the language. It's rare for me to ever describe one approach as the "right" way to do something - but for validating data, Filter really is excellent, offering both validating and sanitising filters and generally making it super-easy to clean up incoming variables. Many of the frameworks offer equivalents, and I'm sure many of those are wrapping this too.