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

Rob Allen:
Adding a user to your Bluemix space
Aug 25, 2017 @ 15:09:01

Rob Allen continues his series looking at the "serverless PHP" environment that is a part of the IBM Bluemix offering. In his previous post he introduced some of the basic concepts of using the service and helped you create a sample "Hello World" function. In this new tutorial he shows how to update that environment and create a user and allow them access to the PHP functions already created.

I'm at the stage where I need to give another developer access to my IBM Cloud Functions actions. I'm not really an infrastructure person and I found the user management pages on the Bluemix console incomprehensible, so used the command line. This is how I did it so that I don't have to work it all out again.

There's only two steps to the process: adding the user to your organization and adding the user to the space. He goes through both steps, explaining how it works and the command line calls to make it happen. This also provides the added user with access to related resources (like databases).

tagged: bluemix serverless user add commandline tutorial ibm

Link: https://akrabat.com/adding-a-user-to-your-bluemix-space/

SitePoint PHP Blog:
Adding Products to Your eBay Store with the Trading API
Jan 13, 2015 @ 18:50:14

The SitePoint blog has posted the next part of their "using the eBay trading API" series today (part three) showing you how to add products to your store via their API.

In this third and final part of our eBay Trading API series, we’ll be building the product adding functionality into our application. Now that we’re done with the store settings, we can begin with writing the code for the controller that would handle the creation of products.

He walks you through the code to create the "new" action on your Slim controller, build the view to gather the product information and handle the upload of product images with the Dropzone Javascript library. Also included is the code to get the current category list (to populate a dropdown list) and the code needed to create the product, both in your database and sending it back to the eBay API for insertion. This finishes the series about using this API, but you can get more information on the API itself though its documentation. The full code for the tutorial series is available on GitHub.

tagged: ebay trading api tutorial series part3 add product upload

Link: http://www.sitepoint.com/adding-products-ebay-store-trading-api/

Nikita Popov:
How to add new (syntactic) features to PHP
Jul 30, 2012 @ 14:54:34

Nikita Popov has a new post to his site looking at how you can add your own syntactic features directly to PHP (requires knowledge of the C language).

Several people have recently asked me where you should start if you want to add some new (syntactic) feature to PHP. As I’m not aware of any existing tutorials on that matter, I’ll try to illustrate the whole process in the following. At the same time this is a general introduction to the workings of the Zend Engine. So upfront: I apologize for this overly long post.

He covers the usual "life" of a PHP script, how tokenization is handled and what happens when the script is parsed, compiled and executed. Code snippets are included to show you the points to add in your own syntax item - in their case, adding an "in" operator to see if a value is in an array (a one word version of this).

tagged: syntax tutorial add new c language

Link:

Brian Moon's Blog:
Errors when adding/subtracing dates using seconds
Jan 17, 2012 @ 17:19:22

Brian Moon has a reminder about date handling in PHP - days are not always 86400 seconds long, sometimes there's "leap seconds" included too. Thankfully, there's easy ways around it:

The problem with this is that it assume that there are only 86400 seconds in every day. There are in fact not. On days when the clocks change for daylight savings time, there are either 1 hour more than that or 1 hour less than that. In addition, there are also leap seconds put into our time system to keep us in line with the sun. There is one this year, 2012, on June 30th in fact. Since they don't happen with the regularity that daylight savings time does, it may be easy to forget those. Luckily, for this problem, the solution is the same.

His first solution involves letting strtotime do the work for him, internally calculating the leap seconds or any other issue that might come up. As an alternate solution, he also mentions "doing your math at noon" - this gives you enough leeway to make the offset leap seconds could cause a much smaller risk.

tagged: error add subtract date seconds strtotime noon

Link:

Script-Tutorials.com:
How to Use APC Caching with PHP
Sep 15, 2011 @ 13:29:14

On Script-Tutorials.com today there's a new article introducing you to using APC caching in your PHP applications. Their simple example sets up a caching class that handles the dirty work for you.

Today I have another interesting article for PHP. We will talking about caching, and practice of using caching in php. I will make review of APC caching and will show you how you can use APC in PHP. [...] Now people have learned to use the server memory for data storage. RAM much faster than hard disk, and the price of memory falls all the time, so let’s use all these advantages of this.

Included in the post is the code for a few different files - the caching class itself that implements the APC functions in PHP and some examples of it in use: saving objects, fetching data from the cache and removing things from the cache.

tagged: caching apc tutorial class add remove fetch

Link:

Ian Selby's Blog:
Dynamically Add Functions to PHP Classes
Jan 05, 2009 @ 16:26:50

Ian Selby has posted a new tutorial today looking at something that can be very handy in the right situations - dynamically adding new functions to an already defined PHP class.

I've gotten a lot of great suggestions for features [for PHP Thumbnailer], and have wanted to add them, but at the same time don't as I would prefer not to bloat the class with all sorts of functionality. So I started thinking about how I could provide certain functionality for people that want it, without either simply making it a part of the class (and making it more bloated as a result), or coming up with all sorts of extended classes to maintain and distribute.

His solution was to add functionality dynamically to the class as plugins. Each plugin is defined as its own class (to keep things standardized) and will be included/executed by a base controller class. He includes some sample code showing how to create a basic user object that can store the first and last names of the user in question.

tagged: dynamic add function method class plugin tutorial user

Link:

Vidyut Luther's Blog:
Adding Subscribers to Campaign Monitor Lists using PHP5 and SOAP
Dec 15, 2008 @ 15:33:07

If you're a Campaign Monitor user (an email marketing tool targeted at designers) and have wanted to dynamically add people to your lists, Vidyut Luther has a solution for you:

This is a quick how to, for people interested in adding subscribers to their Campaign Monitor lists. What you'll need: PHP 5 with SOAP built in, a Valid Campaign Monitor Account, a Campaign Monitor list.

His simple script (about 10 lines with comments removed) makes a call to the service's API and passes in your key, a list and client ID and a call to the AddSubscriber method to push the new contact into the list.

tagged: campaignmonitor mailing list add subscriber tutorial php5 soap

Link:

Havard Eide's Blog:
SplObjectStorage
Jul 23, 2008 @ 13:47:44

Havard Eide has a recent post to his blog that looks at a part of the Standard PHP Library (SPL) that can be used with objects to store them for later use - SplObjectStorage.

In this post I will look at SplObjectStorage: a container that allows to store objects uniquely without the need to compare them one by one.

He lets the code to most of the talking, showing how to do the standard operations for a data store - adding objects (both unique and the same), updating objects in the store, checking to see if an object is already added and removing an object from storage.

tagged: splobjectstorage add unique update check data storage object remove

Link:

Ilia Alshanetsky's Blog:
mail() logging for PHP
Dec 13, 2006 @ 22:56:00

In his latest blog entry, Ilia Alshanetsky has proposed (and provided) a patch that can help with one of the more abused of the popular PHP functions out there - mail().

One of the problems with solving the mail() abuse is figuring out who is doing it or perhaps what script was exploited to do it, since the mail() function does not offer any logging mechanism.

To address this problem, he's supplied this patch you can apply to your source to add two new options to the mail function:

  • enable the addition of the X-PHP-Originating-Script header
  • mail.log (takes a filename) allows you to enable logging of every single mail() call
Check out his entry for more details on configuration options and other functionality included with the patch.

tagged: mail logging function patch add header configure mail logging function patch add header configure

Link:

Ilia Alshanetsky's Blog:
mail() logging for PHP
Dec 13, 2006 @ 22:56:00

In his latest blog entry, Ilia Alshanetsky has proposed (and provided) a patch that can help with one of the more abused of the popular PHP functions out there - mail().

One of the problems with solving the mail() abuse is figuring out who is doing it or perhaps what script was exploited to do it, since the mail() function does not offer any logging mechanism.

To address this problem, he's supplied this patch you can apply to your source to add two new options to the mail function:

  • enable the addition of the X-PHP-Originating-Script header
  • mail.log (takes a filename) allows you to enable logging of every single mail() call
Check out his entry for more details on configuration options and other functionality included with the patch.

tagged: mail logging function patch add header configure mail logging function patch add header configure

Link:


Trending Topics: