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

Community News:
PHP-FIG PSR Update
Mar 16, 2018 @ 16:57:45

The PHP-FIG group, the ones responsible for the standards that helped to make Composer a real possibility (PSR-0 and PSR-4) have posted a general update of the various PSRs that are currently in progress and a brief summary of the status on each.

Hello everyone, we (the secretaries) decided it was time to post a status update for the PSR which are pending, as a way to update you members and the whole community on our work, and also to start discussion around some PSR that need a little more participation.

Current PSRs in the list include:

  • PSR-5: PHP docblock recommendations
  • PSR-12: Coding style guidelines
  • PSR-17: HTTP factories
  • PST-19: Streams/Async processing

If you would like to participate in the working group for any of the items listed in the full post, reply to it and the group will get back with you shortly.

tagged: phpfig psr update list status

Link: https://groups.google.com/forum/?fromgroups=#!topic/php-fig/ywaSYo_tXdc

Phil Sturgeon:
Avoid Hardcoding HTTP Status Codes
Aug 17, 2015 @ 17:55:53

Phil Sturgeon has a post to his site with a good recommendation for those working with APIs and those "magic numbers" that are HTTP status codes - avoid hard coding them in your applications and tests.

A lot of things in programming are argued to death, but one subject where people almost unanimously agree is that magic numbers can be a pain in the ass, and they should be avoided whenever possible. Sadly when it comes to HTTP status codes, people keep on hardcoding them, and it leads to all sorts of confusion. [...] What is 409? If you answer without looking it up on Dash or HTTP Status Dogs then you are a machine.

He shows two implementations of this idea, one in Ruby and the other in Symfony, where the status code value is represented by a constant rather than by a number. The constant correlates to the HTTP status code (number) but the constant makes it easier to read and understand the code. He points out two libraries that can be substituted into your current testing to replace those hard coded values with more expressive versions: lukasoppermann/http-status and Teapot.

tagged: avoid hardcode http status code opinion expressive teapot httpstatus

Link: https://philsturgeon.uk/http/2015/08/16/avoid-hardcoding-http-status-codes/

Phil Sturgeon:
PHP 7 Feature Freeze
Mar 16, 2015 @ 14:04:44

Phil Sturgeon has a new post to his site looking at the PHP7 feature freeze for this upcoming major PHP release (implemented as of yesterday, the 15th). In it he provides a list of features, their related RFCs and how likely they are to make it into PHP7.

Today was the feature freeze for PHP 7. That means no new votes can be started for a feature that is aimed at PHP 7.0, and would instead have to go into PHP 7.1. Instead of heading out to St Patric’s Day with a bunch of New Yorkers making dubious claims about their tenuous connection to Irish ancestry as an excuse to drink, I thought it would be a good time to review some of the more recent RFCs that made it in, and those that didn’t.

His list includes:

  • Remove PHP 4 Constructors
  • Spaceship Operator
  • Replacing current json extension with jsond
  • Skipping Optional Parameters for Functions
  • Constructor behaviour of internal classes
  • Reclassify E_STRICT notices

Each one has a link to the current version of the RFC, the current status and Phil's own opinion of the feature (usually just one word).

tagged: php7 feature freeze rfc list status opinion

Link: https://philsturgeon.uk/php/2015/03/15/php-7-feature-freeze/

Matthew Weier O'Phinney:
Deployment with Zend Server (Part 5 of 8)
Sep 10, 2014 @ 18:40:49

Matthew Weier O'Phinney has posted the latest in his "deployment with Zend Server" tips today, part five of eight. In this latest post he talks about setting the status of a job.

This is the fifth in a series of eight posts detailing tips on deploying to Zend Server. The previous post in the series detailed how to secure your Job Queue job scripts. Today, I'm sharing some best practices around writing job scripts, particularly around how to indicate execution status.

When he talks about the "status" of a job he's referencing the return code that's provided back to the executing script sharing the pass/fail status of its execution. He shows how to use the ZendJobQueue object and the setCurrentJobStatus to return a constant, either "FAILED" or "OK". He shows how to use it in an isolated example, outputting the results back as a plain text message that can be found in the "Output" tab of the job.

tagged: zendserver deployment tips series part5 return status failed ok

Link: https://mwop.net/blog/2014-09-09-zend-server-deployment-part-5.html

Johannes Schlüter:
PHP 5.5 is out, what's up with 5.4 and 5.3?
Jun 24, 2013 @ 14:25:47

Johannes Schlüter has a new post for those wondering what's going to happen to PHP 5.3 and 5.4 now that PHP 5.5 has been released.

Yay, finally we released PHP 5.5, which is a new big release for PHP. In preparation for this I yesterday sent out a mail to the PHP core developers stating that the "PHP-5.3 BRANCH IS CLOSED NOW" [...] What this means for users of PHP is that they can continue using PHP 5.3 and when upgrades come they are very low risk of breaking anything (we always try not to break anything, but any person's bug might be another person's feature) so they should be applicable easily and applied fast.

So, PHP 5.3 users can upgrade in the 5.3.x series without having to worry too much about breakage. PHP 5.4 users should be able to easily upgrade to 5.5 without many issues too: "PHP 5.5 also mostly uses the same code as 5.4 with a few extra features."

tagged: language release upgrade older version status

Link: http://schlueters.de/blog/archives/173-PHP-5.5-is-out,-whats-up-with-5.4-and-5.3.html

PHPMaster.com:
REST - Can You do More than Spell It? Part 4
May 21, 2012 @ 13:44:26

PHPMaster.com has posted the latest tutorial in their series covering RESTful APIS - part four of "REST - Can you do More than Spell it?" In this latest part of the series, they focus on something very key to RESTful services, the HTTP spec (and headers).

We're getting close to the end now, and the only thing remaining is to discuss a little more about the protocol you'll most likely use in any RESTful application that you write. Because HTTP is so often used with REST, that's the protocol I'd like to focus on.

He goes through the structure of a typical (raw) HTTP header and talks about some of the more common headers and what actions/settings they represent. He includes examples of setting headers (with header, naturally) and a curl example showing how to set the request headers. The tutorial is finished off with a brief mention of custom HTTP headers and the the good and bad that comes with them.

tagged: rest api tutorial series http spec protocol status header

Link:

PHPMaster.com:
Zend Job Queue
Jan 13, 2012 @ 14:37:31

In this most recent post to PHPMaster.com Alex Stetsenko takes a look at the Zend Job Queue functionality, a part of the Zend Server installation. He talks about some basic usage to make HTTP requests and a more extended example showing report generation.

Web applications usually follow a synchronous communication model. However, non-interactive and long-running tasks (such as report generation) are better suited for asynchronous execution. One way to off-load tasks to run at a later time, or even on a different server, is use the Job Queue module available as a part of Zend Server 5 (though not as part of the Community Edition). Job Queue allows job scheduling based on time, priority, and even dependencies

In his two examples, he shows the code involved to create a new Queue object and define a HttpJob in it. The first just calls a "sample.php" script that's exposed as a part of your external-facing site and shows how you can get the current status of the job. The more advanced example shows a call to a "report.php" script with a set of options defining things like "type", "length" and "priority". He also points out some other options that can do similar things like Gearman, NodeJs and RabbitMQ.

tagged: zend job queue zendeserver tutorial task status

Link:

PHPBuilder.com:
Harness the Scripting Power of PHP and cURL to Update Facebook
Feb 16, 2011 @ 19:30:19

On PHPBuilder.com today there's a new article from Marc Plotz looking at how you can use PHP and cURL with Facebook to update your status.

You probably know that cURL is a wonderful tool for extracting data from a Web page -- that's a given if you are a developer worth your salt. However, in this article, I want to show you how to use cURL to do things for you. We will start by exploring cURL in detail and then move on to use a very cool script to update our Facebook status.

He introduces cURL for those that aren't familiar with it already (including how to tell if it's installed) and some basic code to show a GET request on a remote file. Things get a little more complicated from there - you'll need to set up some cookies for Facebook, use some regular expression matching to find the form to submit to and send the POST data correctly for the update.

tagged: curl tutorial script facebook update status

Link:

PEAR Blog:
PEAR in August
Aug 16, 2010 @ 13:32:56

On the PEAR blog there's a new post updating you on some of the happenings with the PHP packaging tool recently.

We've been fairly quiet, launching pear2 and pyrus into the line up, welcoming new faces to the QA team, Jesus Espino, and getting ready to call an election for the new pear group.

They also mention several package releases (including updates to Net_DNS and Services_Twitter) and a call for contributions from anyone out there by working on deprecated code, unit tests or even just bug reports.

tagged: pear package update status august

Link:

NETTUTS.com:
Diving into the Twitter API
Mar 30, 2010 @ 13:57:16

In a new tutorial from NETTUTS.com today Siddharth gives you a guided tour through some of the Twitter API and includes code - Javascript and PHP (using cURL) - you can use to access it.

As we move towards the social web and mashups, a good API is not a nice addition anymore: it is downright necessary. And remember, too much abstraction is never a good thing. While there are a number of API kits out there to simplify working with the API in question, wouldn’t it be cool to know what is actually going on under the hood? Wouldn’t it be exciting to deconstruct the actual voodoo going on between the kit and the API? Yeah, I thought so!

He covers the three different Twitter APIs, the REST, search and stream APIs but focuses on using the REST method to pull out the information you need. The code examples show you how to get your own latest status, update your current status and use the search.twitter.com site to find tweets matching your search term and pull them back as a JSON message.

tagged: twitter api tutorial status javascript curl

Link:


Trending Topics: