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

SitePoint PHP Blog:
Getting Started with PHP Underscore
Apr 17, 2014 @ 13:50:28

The SitePoint PHP blog has a new article posted showing you how to get started with Underscore, a PHP library ported over from Javascript's popular Underscore.js library with many of the same methods intact.

If you’ve ever used the Backbone framework for JavaScript, you’ll already be familiar with Underscore. Indeed, it’s become incredibly useful for JavaScript developers in general. But did you know that it’s been ported to PHP? [...] Underscore describes itself as a “utility belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects. It’s the tie to go along with jQuery’s tux, and Backbone.js’s suspenders.”

He starts by showing you how to get it installed and some of the basic syntax of the methods it defines (basically replace the period with the double-colon) for both the procedural and OOP handling. He shows examples of a few of the more handy methods it provides including:

  • Each
  • Pluck
  • Minimum and Maximum
  • Filter and Reject
  • sortBy
  • groupBy

...and many more. There's also a bit of talk about templating and extending the library via "mixins".

tagged: underscore port introduction methods functionality

Link: http://www.sitepoint.com/getting-started-php-underscore/

Lorna Mitchell:
PHP and Gearman: Unable to connect after upgrade
Feb 28, 2013 @ 12:55:48

Lorna Mitchell has shared some advice about correcting an issue with PHP and Gearman after she did an upgrade via PECL.

I upgraded PHP and related pecl modules on my development machine today, and ran into a problem with Gearman. Actually I ran into more than one! Firstly the challenge of getting the newest pecl version working with a gearman version. Then an error where my existing PHP application couldn't connect to gearman after upgrade.

Running on Ubuntu, she found this tutorial helpful in getting Gearman back into a working state and installed (version 1.1.1). The "unable to connect" error turned out to be a change in how the Gearman connection needed to be made - the addition of a port to the connection string made things work again.

tagged: gearman connection issue pecl ubuntu port


Liip Blog:
2-Step Verification with Google Authenticator and PHP
Aug 31, 2011 @ 09:53:05

On the Liip blog there's a recent post talking about a tool Google offers to help you authenticate your users, a one-time passcode generator called Google Authenticator. The post talks about a PHP port of the same idea.

The main point about 2-step verification is that something else than your computer provides that token. If it's on your computer and that one gets stolen (or hacked into), it won't help much for the additional security. That's why you need a second device for those tokens. Some banks do that with SMS/Text Messages (Facebook, too), other give you special devices for that (eg. RSA keys) and the last group does it with your smartphone.

At the request of a client, they created a tool that did just this, but for PHP. As a result, they created the GoogleAuthenticator library that makes it easy to implement in your application. There's even an example of it in use. For more information about the Google Authenticator tool, see this page on Google Code.

tagged: google authenticator library port twostep verification user qrcode


Gareth Heyes' Blog:
Aug 23, 2011 @ 10:21:40

Gareth Heyes has a recent post pointing out the port of a project of his, CSSReg (a filtering tool for user-provided stylesheets) over to PHP.

Just a quick post to mention the excellent work by Norman Hippert aka @thewildcat, he successfully converted my Javascript based CSSReg into PHP. I was meaning to do this but never found the time so it’s pretty awesome that not only did thewildcat convert the code but found some nice bugs in my code and fixed them. Great work Norman thanks very much!

You can see a demo of it here and grab the source as a download here. You can find out more about the origins of CSSReg (and some of its siblings) in this other post from Gareth.

tagged: cssreg regular expression javascript port demo


Maarten Balliauw's Blog:
A client side Glimpse to your PHP application
Aug 03, 2011 @ 11:28:54

Maarten Balliauw has announced the release of a PHP port of a powerful tool for server-side introspection of your applications - Glimpse for PHP.

A few months ago, the .NET world was surprised with a magnificent tool called "Glimpse". Today I'm pleased to release a first draft of a PHP version for Glimpse! Now what is this Glimpse thing… Well: "what Firebug is for the client, Glimpse does for the server... in other words, a client side Glimpse into whats going on in your server."

He includes a of how the introspection works and some sample code using a phar to add it to your PHP application. You can see it in action in this screencast based on the PHP Azure Contest website. He also shows one very cool feature that allows for cross-device tracking of requests. You can find this PHP port of Glimpse on github.

tagged: glimpse port introspection phar server plugin client


Jeff Moser's Blog:
Notes from porting C# code to PHP
Oct 26, 2010 @ 12:49:08

In a new post to his blog Jeff Moser takes you through some of his experiences in port code from C# to PHP as a first-time PHPer and learning right from a book.

After years of hearing negative things about PHP, I had been led to believe that touching it would rot my brain. Ok, maybe that's a bit much, but its reputation had me believe it was full of bad problems. Even the cool kids had issues with PHP. But I thought that it couldn’t be too bad because there was that one website that gets a few hits using a dialect of it. When Kaggle offered to sponsor a port of my TrueSkill C# code to PHP, I thought I'd finally have my first real encounter with PHP.

He starts with a few disclaimers, noting that the structure of the application was kept largely the same and that he didn't go much into the web or database functionality that PHP's well known for. He talks about the book he chose to learn from (Beginning PHP 5.3) and includes some excerpts from the author talking about the PHP language. He splits up the rest of the post into several different sections covering his thoughts on the whole process:

  • The Good Parts
  • The "When in Rome..." Parts
  • The "Ok, I guess" Parts
  • The Frustrating Parts

Unfortunately, the "Good" parts section is one of the smallest.

tagged: port experience csharp trueskill


Port Scanning and Service Status Checking in PHP
Apr 08, 2009 @ 08:49:21

On the DeveloperTutorials.com site today there's a new tutorial showing the creation of a port scanner with PHP - a tool that, given some of the familiar ports that services (like web or email servers) run on, can check to see if they're responding.

While building web applications, it's often important to keep an eye on the other services running on your server. Having access to the current status of public servers can empower your applications to make decisions and respond to problems automatically. Acknowledging a service is offline can also save endless support emails. In this tutorial, I'll show you how to keep track of your server status by scanning ports on your server with PHP.

Their example makes a socket connection to the remote port to see if there's a valid hookup. The wrap this inside a loop for ports 1 through 1000 to see what ports are open and responding on your local machine (doing this on a remote machine is just asking for trouble).

Their full example defines some of the common ports in an array and loops to check on their status. It sets out a base you can build on top of with things like their suggestions - logging scan results, repoting downtime and running a service-specific task.

tagged: port scan fsockopen socket http ftp pop3 check connection


Ant Phillips' Blog:
Integrating SAP NetWeaver in Zero PHP
Mar 20, 2009 @ 09:02:25

In a recent post to his blog Ant Phillips looks at how you can integrate the SAP Netweaver softare into Zero PHP (a Java PHP clone).

I thought it would be interesting to hook up a Zero PHP application with a SAP NetWeaver system. So last weekend I summoned up the courage and, armed with a bottle of red wine, set about the task. Surprisingly enough it wasn't too difficult (setting aside finding 20GB of disk space needed by the installer).

He talks about making the connection via SAP's JCo middleware component and the PHP/Java bridge that comes with the standard Zero installation. Code is included showing how to make the connection and grab information from the SAP data store.

tagged: zerophp java port sap netweaver integrate bridge jco


Vinu Thomas' Blog:
PHP functions in Javascript using PHP.JS
Jan 09, 2009 @ 08:45:12

Vinu Thomas has mentioned a project that is trying to port as many of the standard PHP functions over to Javascript as possible - PHP.JS.

PHP programmers usually have to handle HTML & Javascript front-end coding as well and I’m sure a lot of us have been frustrated with the lack of those easy to use PHP functions in Javascript like those array, encode/decode and string functions. Here’s a Javascript project which provides you just that.

The project currently has over two hundred and thirty functions ported and put into a single, easy to download library (with three versions - normal, mini and packed). Then you're just a script tag away from including it and putting it to good use. You can find out more on the PHP.JS homepage.

tagged: javascrpt convert port function library phpjs


Developer Tutorials Blog:
Port Scanning and Service Status Checking in PHP
Jun 10, 2008 @ 08:46:08

The Developer Tutorials blog has posted a new tutorial covering how to scan ports and checking a remote service's status with PHP.

Having access to the current status of public servers can empower your applications to make decisions and respond to problems automatically. Acknowledging a service is offline can also save endless support emails. In this tutorial, I'll show you how to keep track of your server status by scanning ports on your server with PHP.

They show how to check a remote instance (a socket open with a timeout) and how to run through a list of ports, looping from one to one-thousand and running an fsockopen on each. They make a sample script to show these two combined - a simple page that loops through the common protocols (HTTP, FTP, SSH, etc) and checks to see if the remote machine is running something on that port.

tagged: port scan service status check fsockopen http ftp ssh