PHP Advent

Articles

New pieces on PHP today, then everything from the archive.

New

  1. #[Tooling]

    PHPStan on Legacy Code: Baselines, Levels, and Green CI

    Add PHPStan to a legacy PHP codebase without halting feature delivery. Choose a starting rule level, generate a baseline, configure CI, and get to green.
    14 min
  2. #[Language]

    PHP 8.5 Features: What Changed and How to Upgrade

    Explore new PHP 8.5 features with runnable examples, from the pipe operator and clone with syntax to deprecations, breaking changes, and upgrade testing tips.
    15 min
  3. #[Tooling]

    PHP Profiling: Xdebug, SPX, XHProf, and Blackfire Compared

    Find out why PHP requests run slowly in modern PHP. Compare Xdebug, SPX, XHProf forks, and Blackfire with install configs, overhead, and production trade-offs.
    17 min

Archive

96 articles from the PHP Advent calendars.

  1. #[Archive]

    Because It’s Fun!

    Twelve years ago, computers were a mystery to me, but a friend of mine showed me how I could just go down to the computer parts store, pick out a...
    Derek Sivers · 3 min
  2. #[Archive]

    More Than Just Style

    PHP CodeSniffer is a wonderfully simple tool for implementing and enforcing a coding standard. The basic installation comes with a handful of...
    Laura Beth Denker · 5 min
  3. #[Archive]

    Reduced-Friction Deployment

    I view my job as shepherding code from its inception in a Vim buffer, in a terminal session, in my development environment, until it makes it up into...
    Chris Hartjes · 3 min
  4. #[Archive]

    Better Than the Rest

    If you’ve written a web service that other clients are going to connect to, I’m willing to bet you think you’ve done a pretty good job. I would like...
    Rob Allen · 3 min
  5. #[Archive]

    A Stitch in Time Saves Nine

    It is easiest to describe the N+1 problem by example. Take a look at the following bit of PHP in a hypothetical blog app: We have a master set of...
    Paul Jones · 7 min
  6. #[Archive]

    Dates and Times

    Having dealt with a lot of dates and times — and the calculations between them — recently, I thought it might be a good idea to write down some of...
    Evert Pot · 6 min
  7. #[Archive]

    Twilio in Two Minutes

    I love Twilio . If you’re not familiar with Twilio and the amazing voice and text messaging stuff you can do with it, you’re in luck! I’m going to...
    Elizabeth Naramore · 4 min
  8. #[Archive]

    Integration Testing

    At some point in our respective programming careers, most of us have heard that Test-Driven Development (TDD) is what we should be doing. The TDD...
    Wez Furlong · 6 min
  9. #[Archive]

    Merry Error Handling

    PHP does not enjoy the same consistency in error (and exception) handling as other languages, mostly due to historical reasons and the lack of a...
    Samer Atiani · 5 min
  10. #[Archive]

    Better Object-Oriented Arrays

    I’ve been working on developer-facing software and SDKs in PHP for nearly a decade, and through the experience of supporting these developers, I’ve...
    Ryan Parman · 6 min
  11. #[Archive]

    Out with the Old

    Jetpacks. Flying cars. Databases able to handle infinite amounts of data. Breakthrough after breakthrough, computer engineering forges a shiny...
    Maggie Nelson · 5 min
  12. #[Archive]

    Bake Cookies Like a Chef

    It’s Christmas time again. While you write the first lines of your shiny new authentication library, the smell of tasty cookies is slowly sneaking...
    Michael Nitschinger · 7 min
  13. #[Archive]

    Don’t Forget the Front

    Everyone talks about automated testing for your code, but that’s only half of the testing I need. What about the front end? Forms need some testing...
    Beth Tucker Long · 3 min
  14. #[Archive]

    Nightmare Before (Last) Christmas

    A little over a year ago I was plunged into a nightmare world. I had accepted a new job as the lone PHP developer at a relatively small business, and...
    Jeremy Kendall · 4 min
  15. #[Browser]

    Cross-Origin Ajax with CORS

    Cross-origin requests without JSONP or proxies: the CORS headers a PHP backend has to send.
    David Walsh · 4 min
  16. #[Archive]

    Cracks in the Foundation

    PHP has been around for a long time, and it’s starting to show its age. From top to bottom, the language has creaky joints. I’ve decided to take a...
    Gwynne Raskind · 11 min
  17. #[Archive]

    PHP for All the Things

    PHP was originally designed for web sites and is still widely thought of only as a programming language for the Web. But with the approaches below...
    Matt Graham · 4 min
  18. #[Archive]

    Simplifying Commerce for Small Business

    Selling has never been easy. There’s too much red tape. The simple act of you giving me currency in exchange for a good or service I provide is not...
    Ben Ramsey · 6 min
  19. #[Archive]

    Egomaniacal and Scalable Apps

    The rise of cloud computing over the past few years has been incredible. Unfortunately, many still do not see the interest or do not comprehend its...
    David Coallier · 5 min
  20. #[Archive]

    Code for the Users, Not for the Spec

    I don’t know exactly when it was that I started to resent the people I was writing code for, but it was a sure sign that I was feeling burned out....
    Drew McLellan · 6 min
  21. #[Archive]

    Social-Driven Development

    As any developer can tell you, the way we write apps has changed dramatically over the past year. It’s been amazing to see how the quality of code...
    Chris Cornutt · 4 min
  22. #[Archive]

    Keep the Front in the Front

    I’m both a front- and back-end developer, and, at edgeofmyseat.com , we mainly work on projects where we get to control the full stack — from server...
    Rachel Andrew · 6 min
  23. #[Archive]

    Look Ma! No Passwords!

    Your user sign-in experience is one of the most important interactions on your site, and all of the options you have fall short of what you need. You...
    Dan Mills · 2 min
  24. #[Archive]

    Facilitating Development Environment Consistency

    Every developer is different, but your team’s development environment does not have to be. A modern web app uses many different technologies. Common...
    Jeff Loiselle · 7 min
  25. #[Archive]

    Localization

    When creating a web site, it is important to consider the audience. Regardless of whether the web site is selling goods, providing a service, or...
    Anthony Gentile · 6 min
  26. #[Archive]

    First-Class APIs

    APIs are commonly an afterthought, like a hot tub awkwardly attached to a house — a shoehorned approach that produces a suboptimal app with scarce...
    Helgi Þormar Þorbjörnsson · 5 min
  27. #[Performance]

    Profiling with XHGui

    Profiling PHP in production with XHProf and XHGui: finding the slowest and hungriest calls, and what opcode caches change.
    Paul Reinheimer · 7 min
  28. #[Archive]

    The Thing with the Two Heads

    (With apologies to Rosie Grier .) As web developers, we usually think of the apps or sites we create as single, contained units. That’s...
    Ed Finkler · 3 min
  29. #[Archive]

    Code for Today

    Most programmers are lazy, for some value of lazy. Many of us claim that we are efficient, doing no more than is actually needed, pulling resources...
    Lorna Mitchell · 3 min
  30. #[Archive]

    JavaScript for PHP Developers

    Hopefully, you’ve been a good geek in 2010. You’ve followed last year’s advice and learned some JavaScript. Now, let’s kick back with a glass of wine...
    Stoyan Stefanov · 8 min
  31. #[Archive]

    Bits and PHPieces

    I like to think of PHP as a mixed bag of tricks. The language itself was born out of some simple, real-world use cases , and that ideology still...
    Joël Perras · 4 min
  32. #[Archive]

    Output Buffering

    When I chose to write about output buffering for this year’s PHP Advent, my depth of knowledge on the subject was very limited. I picked a topic that...
    Nicholas Sloan · 7 min
  33. #[Archive]

    Building Mobile Apps with PHP

    Way back when I first dove into web programming, PHP was the obvious choice for my needs. It was available on virtually all web servers, had...
    Jonathan Stark · 6 min
  34. #[Archive]

    Everyone Loves PHP

    A year ago today, I started at Facebook. I’ve been using PHP for the last twelve years, and before I got there, I thought I had seen most PHP-related...
    Scott MacVicar · 6 min
  35. #[Archive]

    Managing LAMP

    One of the things that initially attracted me to PHP was that I could write all of my apps in pure PHP, and they would run anywhere I deployed them....
    Marcel Esser · 7 min
  36. #[Archive]

    Share and Enjoy

     “ Share and Enjoy ” is the motto of a certain division of the largely successful Sirius Cybernetics Corporation . I’m here to complain about it....
    Gopal Vijayaraghavan · 5 min
  37. #[Archive]

    Streams

    If you want to start building your own apps, one of the most important things you need to know is how to access APIs. How else are you going to get...
    Lisa Denlinger · 5 min
  38. #[Archive]

    Usage Statistics

    A few years ago, Damien Seguy started collecting information about what version of PHP people were using and how PHP’s usage compared to competing...
    Ilia Alshanetsky · 6 min
  39. #[Archive]

    Debugging

    “There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is...
    Nate Abele · 8 min
  40. #[Archive]

    Legacy Jungle

    At some point in every developer’s career, they get the opportunity to work on a gnarly, horrible briar patch of a project. Surviving that experience...
    Mark Story · 4 min
  41. #[Archive]

    Thumbnails

    Many of us have had the pleasure of building a web application that requires the automated building of thumbnails from images that are uploaded at...
    Owen Winkler · 6 min
  42. #[Archive]

    Text and Media Files

    With a team of developers, I recently built a mission-critical web app that relied heavily upon the manipulation of files. I’d like to give you a...
    Anna Filina · 3 min
  43. #[Archive]

    The Ghost of Christmas Past

    PHP has been around nearly as long as there has been a Web to develop for, but it evolves constantly and is a modern programming language by almost...
    Luke Welling · 8 min
  44. #[Archive]

    Big Data

    Big data, data science, analytics. These are some of the hottest buzzwords in tech right now. Five years ago, the boasting rights went to the geek...
    Laura Thomson · 5 min
  45. #[Archive]

    Color for the Holidays

    If part of your job involves debugging or monitoring PHP apps, you’ll most likely have used tail to check for errors in a log file. While practical,...
    Jon Bond-Caron · 3 min
  46. #[Archive]

    Don’t Panic

    It’s finally happening. The end is near. The server is about to be destroyed by a fleet of Vogon cruisers. Actually, the server is about to be...
    Derick Rethans · 4 min
  47. #[Archive]

    Aspect-Oriented Design

    I try to write simple apps. I try to code for today , as Lorna articulated so well. Almost invariably, I end up with something more complex than I...
    Garrett Woodworth · 5 min
  48. #[Archive]

    Mistrust and Verify

    When working on a web app with coworkers or fellow volunteers, few things are more important within the group than trust. Trust among developers...
    Kitt Hodsden · 7 min
  49. #[Archive]

    Comprehensible Code

    “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” — Refactoring: Improving the Design...
    Paul Jones · 6 min
  50. #[Archive]

    You Really Need to Learn JavaScript

    PHP developers have typically worn a few hats. Few of us are “pure” PHP developers, where we only write PHP and don’t scribble together some HTML at...
    Ed Finkler · 5 min
  51. #[Archive]

    Do URLs Matter?

    I liked how Chris and Sean describe their role as curating PHP Advent, so I thought I’d do a little sub-curation of my own. This entry is a...
    David Sklar · 3 min
  52. #[Archive]

    One Step at a Time

    I have the privilege, in my current line of work, to be able to attend quite a number of conferences and other technical events throughout the year....
    Lorna Mitchell · 6 min
  53. #[Archive]

    Automate Your Deployment

    Deploying your web site to a server can be an exercise in frustration and fraught with mistakes. There’s a lot to remember during deployment, from...
    Rob Allen · 8 min
  54. #[Archive]

    Parenting Versus Programming

    Advent calendars are about Christmas, and for me Christmas has always been a time for family. This year I have recently joined the ranks of the...
    Laura Thomson · 4 min
  55. #[Archive]

    Get a Haircut

    Getting a job can be a harrowing experience. Many companies run candidates through a gauntlet of tests and interviews in the hopes of separating the...
    Jonathan Snook · 5 min
  56. #[Testing]

    Testing with PHPT and xUnit

    Keeping a test suite fast enough that people keep running it, by combining PHPT files with an xUnit runner.
    Greg Beaver · 11 min
  57. #[Archive]

    Developers Versus Designers

    Developers versus designers is a struggle that has gone on for as long as there have been computers. The bickering has been around for ages, stifling...
    Helgi Þormar Þorbjörnsson · 9 min
  58. #[Encoding]

    Character Sets: Garbage In, Garbage Out

    Why accented characters turn into replacement glyphs, and how to get one character set right from form to database to template.
    Paul Reinheimer · 7 min
  59. #[Archive]

    World of PHPCraft

    Dear Santa, I’ve been a bad girl this year. I haven’t fixed bugs in my extensions. I’ve barely worked on PHP 6. I only attended a handful of...
    Sara Golemon · 4 min
  60. #[Archive]

    JSON Gotchas

    JSON is a subset of the JavaScript language. JavaScript itself is based on ECMAScript, which is standardized in the ECMA-262 standard . Just this...
    Christian Wenz · 4 min
  61. #[Archive]

    Untitled

    No one reads anymore, and you’re not going to read this. You’re going to scan it. We need to more seriously consider how application design evolves...
    Matt Mullenweg · 3 min
  62. #[Archive]

    CSS and Other People

    The road between design and development is fraught with all sorts of peril — as Helgi has already pointed out . Bringing a visual concept to the Web...
    Marco Tabini · 6 min
  63. #[Archive]

    Dæmonize Your PHP

    Despite the haters, I actually really like PHP. Well-written PHP strikes a solid balance between getting things done and getting things done properly...
    Sean Coates · 5 min
  64. #[Archive]

    Managing Bob

    The interaction between technical people and the project sponsor has common patterns regardless of your employment model. Project sponsors — whether...
    Luke Welling · 7 min
  65. #[Archive]

    PHP’s Not Just a Language

    “I did not develop the PHP we know today. Dozens — if not hundreds — of people developed PHP. I was simply the first developer.” — Rasmus Lerdorf 1...
    Ben Ramsey · 8 min
  66. #[Archive]

    You Don’t Need All That

    I’ve been writing PHP for a long time. I am not one of its dinosaurs, but I’ve been making it do my bidding since PHP 3. I have also seen a lot of...
    Marcel Esser · 7 min
  67. #[Archive]

    Performance for Web Apps

    When it comes to programming, there are two things that I enjoy doing the most: making things faster and improving security. The two sometimes come...
    Ilia Alshanetsky · 4 min
  68. #[Archive]

    Unmaintainable PHP

    With the recent unemployment rates, everybody realizes that job security is important. The best way to keep a job is to be irreplaceable. If no one...
    Stoyan Stefanov · 8 min
  69. #[Archive]

    GeoIP Wrangling

    When making the Analog holding page, we wanted to add a touch of personality to make the experience warmer and more welcoming. One of our ideas was...
    Andrei Zmievski · 8 min
  70. #[Archive]

    PHP in Odd Places

    PHP has traditionally been used to solve web problems, and for this, it excels. Over the past year and a half, I have been doing some unusual things...
    Derick Rethans · 7 min
  71. #[Archive]

    Exceptional PHP

    Call me crazy, but I love exceptions. I love exceptions to the rules. I love exceptions to language syntax, both programming and natural. I...
    Brandon Savage · 5 min
  72. #[Archive]

    1,500 Lines of Code

    Even the best of us can only write 1,500 lines of code a day, so we need to make those lines count. There were so many great articles in PHP Advent...
    Terry Chay · 22 min
  73. #[Archive]

    You Need the PHP Community

    Let me paint a picture for you—there’s a young developer, sitting in his parents’ basement, hacking away at his latest masterpiece. He has built it...
    Chris Cornutt · 4 min
  74. #[Archive]

    Use Responsibly

    Hopefully you’re following Chris Cornutt’s advice , and you’re engaging the PHP community through a variety of media—forums, IRC, mailing lists, user...
    Matthew Weier O’Phinney · 5 min
  75. #[Archive]

    Don’t Commit That Error

    It’s easy to get caught up in testing patterns, frameworks, and other “correct” ways to to handle testing, but we often overlook some of the simple...
    Travis Swicegood · 6 min
  76. #[Archive]

    Why Using PHP Makes You Cooler

    A few years ago, I had the pleasure of writing a regular column for the now defunct International PHP Magazine where I highlighted sites that were...
    Elizabeth Naramore · 5 min
  77. #[Archive]

    Which Web Service?

    We have seen a dramatic rise of the SOA (Service-Oriented Architecture) in our shiny new Web 2.0 world. Every site has an API of some kind and no...
    Lorna Mitchell · 4 min
  78. #[Archive]

    Questions to Ask Before Changing Jobs

    Over the past six months, I’ve had the same conversation with several people. It usually starts something like this: “<dream company /> is interested...
    Cal Evans · 4 min
  79. #[Archive]

    Commenting on Commenting

    Everyone knows the standard programming mantra “Document your code” (although some people seem to still not follow it), but today I want to talk...
    Eli White · 4 min
  80. #[Archive]

    Getting Started the Right Way

    Everyone has that grand idea. A few want to finally write that open source project or that great novel. Most need to clean the garage. All of us have...
    Keith Casey · 3 min
  81. #[Archive]

    Coping with the Holiday Shopping Spree

    Now that the holidays are closing in, a lot of people are realizing that they have not yet bothered to buy gifts for their close ones, which is why...
    Helgi Þormar Þorbjörnsson · 12 min
  82. #[Archive]

    Guide to Conferences

    There are a wide variety of conferences in the PHP world: there are small half-day conferences at one end of the spectrum and full-blown 5-day...
    Ivo Jansch · 6 min
  83. #[Archive]

    The Framework as Franchise

    Why bother using a public framework not of your own design? You have heard that frameworks are heavy and slow; just look at Rasmus’s benchmarks (and...
    Paul Jones · 8 min
  84. #[Archive]

    JSON is Everybody’s Friend

    Last year I wrote some kind of feel-good, hippie crap for the PHP Advent Calendar. This year I got a haircut, took a shower, and am ready to tell you...
    Ed Finkler · 7 min
  85. #[Archive]

    Optimize This

    One of the greater challenges of writing good software is avoiding bugs. And, if that can’t be done, finding them. There is much to say about proper...
    Maggie Nelson · 7 min
  86. #[Archive]

    “Yet”

    Have you ever wondered why PHP was invented? It’s relatively easy to find out how the language grew out of one of those scratch-an-itch situations...
    Marco Tabini · 4 min
  87. #[Archive]

    MySQL Client Tips

    PHP developers commonly have to work with many technologies other than PHP, and frequently only know enough about them to avoid tripping over...
    Ligaya Turmelle · 7 min
  88. #[Archive]

    PHP Meritocracy

    When Chris Shiflett asked me to write an article for PHP Advent , my first inclination was to talk about Unicode support in PHP 6, why it’s...
    Andrei Zmievski · 5 min
  89. #[Archive]

    Full-Text Searching with SQLite

    I’ve evangelized SQLite a lot this year, speaking at various conferences and user groups to try encourage use and support within many web...
    Scott MacVicar · 4 min
  90. #[Archive]

    Less Whining, More Coding

    How many times have you heard or seen someone griping about PHP? Maybe the documentation was wrong, or they couldn’t figure out how to install it, or...
    Elizabeth Smith · 11 min
  91. #[HTTP]

    Practice Safe Idempotent Methods

    What safe and idempotent HTTP methods mean, and why a GET that changes data will come back to bite you.
    Ben Ramsey · 5 min
  92. #[Archive]

    PHP Is Not Java

    Java has its place. Maybe it has many places. I’m OK with it being on your phone, in your refrigerator, and on my bank’s web site. I’m even OK with...
    Luke Welling · 3 min
  93. #[Archive]

    Listen

    I recently had the opportunity to attend Adobe MAX . Meanwhile, my associate Elizabeth Naramore attended the Microsoft Web Developer Summit. We both...
    Paul Reinheimer · 5 min
  94. #[Dates]

    What Time Is It?

    Why timestamps and zone abbreviations mislead, and how PHP's DateTime and named time zones avoid both.
    Derick Rethans · 4 min
  95. #[Archive]

    On Internationalization

    Two weeks ago, I was in Buenos Aires for CakeFest . It was an excellent opportunity to connect with the community and discover some of the creative...
    Nate Abele · 4 min
  96. #[Archive]

    PHP Without PHP

    Take a simple PHP trick and follow it on a huge tangent to the philosophy of good web architecture. It's an honor to be asked to share my ideas with...
    Terry Chay · 17 min