PHP5 Class for Authorize.net AIM API

I recently had the need to integrate a project with the Authorize.net API and I spent some time searching for an existing PHP class/object that would handle it. While I found several, they seemed to be somewhat out of date, not properly maintained, and most importantly – ugly.

I set out write a very clean, well organized class that was specifically designed for PHP5. I’ve published the class on github and would appreciate any patches you wish to submit back.

http://github.com/botskonet/authorize.net

The class is very basic and will handle the transaction beautifully. It’s working great in a current project. While there are always features I would like to add as the projects grow, this is entirely ready for use and testing now.

Fastspring.com Ecommerce PHP Class

I’ve recently done some work with the Fastspring.com ecommerce website. It’s essentially similar to the flow of a paypal purchase – companies create pages with products and Fastspring acts as the checkout process doing the user information/payment processing work for you.
(more…)

Download Old CakePHP Versions

I’m not really a fan of CakePHP, but I work with it often and understand it well. I recently had a project where a previous developer modified random cakephp library files directly, thus making it difficult for me to upgrade the framework.
(more…)

Announcing Peregrine – a PHP Security Class

Today I release a new php caging class for improved security – Peregrine.

I’ve always been impressed by the idea of a “variable cage” in programming. It’s an additional method of protecting your incoming variables and making sure that you only accept what you’re expecting.

If you’re not familiar with a cage, think of it as a class that copies any (usually incoming) data into an object while destroying the original “unclean” data. At this point you must access this data through the “cage”, which provides a whole bunch of ways to filter out what you don’t want.

So an incoming variable (through a GET/POST request for example) may only need to be a integer. You may use a method that returns or checks for integers, and either removes non-integer characters or returns false.

This provides an excellent wall against any malicious attackers, and really helps you define data validation more accurately within your projects.

There are some others out there, and some are very good. However, none worked as well or were as cleanly coded as I would have liked, so I’ve been working on Peregrine.

It’s hosted at github so you’re welcome to fork it and contribute back any fixes or feature requests you would like.

To learn how to use it, please read the documentation provided with the code and look through the class itself.

http://github.com/botskonet/Peregrine

Storing GMT in MySQL, Timezone Conversion in PHP

At Trellis Development we’re working on several applications which need to frequently convert dates between various time zones.

By default, both PHP and MySQL operate using a single timezone which is identified during installation and is quite often the same as the host server. Both tools allow you to specify a different timezone on the fly, and all following date operations work based off of that locale.

The primary goal is to preserve a base standard time so that we can easily convert between different timezones, without loosing the ability to convert again. Two choices emerged – storing a Unix Time stamp or a date string stored using GMT/UTC time.
(more…)

Integrating QuickBooks for Mac-based Users

During development of a recent point-of-sale / e-commerce package, I started researching ways of exporting data from a web-based application into QuickBooks. A decent tool called Web Connector allows QB to connect with a web source and share information, and there’s even what appears to be a very thorough PHP class for interfacing.

However, Web Connector is Windows-only. My client runs a Mac.

Disclaimer: Prepare to be disappointed.

(more…)

Currently Scheduled PCC Courses

Javascript
I am currently teaching Introduction to Javascript at the PCC Mt. Tabor center in SE Portland. Classes are every Monday until August 24, and there’s still room in the course for those interested. Follow the link above to enroll.

The book was already chosen as I’m essentially a substitute on this one. Despite being published by Microsoft, it covers some essential topics for developing on the web today. It even mentions Firebug (a firefox extension) so it’s nice that it’s not biased towards MSFT.

PHP
In October, I will be teaching the Introduction to PHP course a bit closer to where I live and work. I have not yet selected a book, but I’m currently working on adapting Trellis internal training materials.

There are still spots open so go ahead and register!

Zend Studio 7

Recently, version 7 of Zend Studio was released. Very unhappy with version 6, but previously satisfied with Zend 5.5, I decided to give it another chance to see if they had any luck improving the user experience.

Zend charges you $399 per year to use this software. They’ve got a standard toolkit for every php developer from phpunit support, documentation support, subversion support, code galleries, etc. These would be very useful if Zend had not gotten the user experience part all wrong. For $399 per year, they better have some great advantage over FREE competitors like NetBeans IDE.

(more…)

jQuery Form Builder Plugin

Trellis Development (a parent company of web-based products which I co-founded) has been developing a custom content management system which needed a form creation tool. I adapted a form builder that I created for a previous project as a jQuery 1.3 plugin. It loads in existing form structure data through an XML file (which would be generated on the server) and passes the changes as a serialized array back to the server.

View the Demonstration
Get source from github

I’ve forked the code from the cms to serve as a stand-alone plugin. It’s extremely easy to setup, as all you need to do is to activate it on an un/ordered list item element. Then, write your backend code to handle the incoming array as you need, and output the xml data for when the form loads.

<ul id="form-builder"></ul>
$(document).ready(function(){
	$('#form-builder').formbuilder({
		'save_url': 'save.php',
		'load_url': 'form-a.xml'
	});
});

The save_url is the url that the ajax will be sent to when the user saves the form. The form information is serialized so that the backend programming may handle it as an array.

The load_url is the url of an xml file that describes any existing form information, and the system uses it to restore the fields.

This requires jQuery 1.3+ and uses the scrollTo plugin for nice scrolling.

This is the first revision that’s external to our cms so I’ve labeled it 0.1.

PHP IDE Complaints, i.e. Zend Studio 6 is Crap

Updated: 6/6/09: As of now, I’ve settled on NetBeans as my primary IDE, and Textmate as my secondary. Read below for reasons.

In my line of work, a code editing tool is something that you spend almost all of your day with. There are so many that I keep forgetting what I don’t like about each one, and I return to it six months later thinking it was decent. Here, I’m going to try to outline all of my complaints about each one.

If you’re a developer of any of these, please let me know what I can do to help you fix these problems, or please contact me to explain why I’m failing to see your genius. I’m certain that I’ve been through all of the big ones so if I’m missing one, please let me know.

In general, my must-have features are typically:

(more…)