PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

twilioKit php starter kit

Note: This article was originally published at Planet PHP on 20 June 2010.
Planet PHP

I've adapted my ZFKit for an upcoming Twilio presentation (codestock next weekend!) and created a new project on github for it under the project name atwiliokita. AZFKit was updated a little bit (a basic menu/navigation was added with Zend_Navigation, some example unit tests added) and used as the basis for this.

You can see this in action if you want to play around with it a bit.

I've modified the twilio REST client available from Twilio.com. AWhile functional, it wasn't the easiest thing to use, and I've added a couple helper methods which may make things a bit easier for people.

I've got two examples so far - one is a basic asend SMS message to a phone' controller, which uses my new helper methods in the Twilio_Rest_Client library. AThe second is a small guessing game which demonstrates making use of ZF sessions. AYou enter a phone number (and name!) to call, and the app will call up and ask the person to add two numbers together (aohello dave. AWhat is 4 + 2?a) ABased on your answer provided, you're told whether you were correct or not, then offered a chance to play again.

I should have a few more examples before next weekend, but there's actually quite a bit going on, between the ZF code and the Twilio code. AI'm working on something (in the code now) which will log all the call activity, and I'm working on it logging everything to a Doctrine table.

When you first use twiliokit, you'll need to enter the ascripts' directory and run the ./run script. AThis will create the necessary atcall' table to store the info. AThis is building from a schema.yml file to a local sqlite file. AYou will probably need to chmod 777 the dev.db sqlite file, depending on your system's permissions.

Oh, and there are a couple unit tests in place in the ./tests directory (though certainly not comprehensive).

This is definitely a work in progress, but I wanted to share it on github to allow people to use it and make any changes they need and be able to easily send those changes back to me. AI was on the fence about making this just a working branch on the zfkit project, but it felt like that might get too confusing.

Let me know what you think!