twilioKit php starter kit

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 ‘twiliokit‘.  ZFKit 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  While 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 ‘send SMS message to a phone’ controller, which uses my new helper methods in the Twilio_Rest_Client library.  The second is a small guessing game which demonstrates making use of ZF sessions.  You enter a phone number (and name!) to call, and the app will call up and ask the person to add two numbers together (“hello dave.  What is 4 + 2?”)  Based 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.  I’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 ‘scripts’ directory and run the ./run script.  This will create the necessary ‘tcall’ table to store the info.  This is building from a schema.yml file to a local sqlite file.  You 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.  I 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!

I'm currently working on a book for web freelancers, covering everything you need to know to get started or just get better. Want to stay updated? Sign up for my mailing list to get updates when the book is ready to be released!

Web Developer Freelancing Handbook

Leave a Reply