All posts by ki6i

Kayako PHP API library for Kayako Fusion RESTful API

kayako php api

I personally found the official  Kayako PHP API library 1.1.0 for Kayako Forge quite disappointing. It reminded really on the auto-generated SOAP connectors in Java with the only difference that since it is REST web service there is no way to be sure that the library version that you have will match the one on your Kayako installation.

The official Kayako PHP API quite reminded my on the auto-generated SOAP, with the only difference that the Kayako one isn’t auto-generated.

Some background on auto-generated connectors. They are generated based on the SOAP WSDL descriptors and therefore they are normally slightly large, complicated and messy.  The positive part in them is the reassurance that the connector is going to work with exactly that web service structure that you have installed.

In REST services unfortunately there are no descriptors so it is not possible for you to generated something based on your web service structure.

I find the official Kayako PHP API library poorly designed, because:

  • There are thousands of classes and nestings throughout the library.

That makes the easy web service functionality to look extremely complicated, confusing and uncompromisable.

  • The library constantly throws E_STRICT exceptions due mismatch between the abstract Base class constructors and the classes extended from them.

Normally when one makes library all exceptions should be accepted, because you don’t know what are the error settings of the systems which this library will be integrated in.

  • There are too many specific static variables in the different classes which are hard-coded to the actual web service values.

I found that not only confusing but also a potential for a lot of problems.

The Kayako PHP API solution that I used


After spending the better part of the day in different ways to making that delicious treat to work I just decided to make a really light Kayako PHP API library on my own.

Git repository –

This Kayako PHP API library is built with the same design used in the official Mandrill PHP library. It aims to spare you redeclaring all keys and HTTP related setting.

If you want to read more about the Kayako Fusion RESTful API and the official Kayako PHP API, here is the documentation:

Draw Something Tips&Tricks (Cheat)

Draw Something is quite addictive game for iOS and Android but sometimes is also quite irritating especially, when you are about level 100 and your opponent give you a picture of ‘an Indian‘ expecting that you will guess ‘wigwam’.

Here is what I do in these cases:
Continue reading Draw Something Tips&Tricks (Cheat)

България *след* комунизма

Дойде момента да напиша пак нещо на български. Наскоро осзнах колко малко знам за комунистическото ни минало и история. Може би защото историята никога не ми е била един от любимите предмети, може би защото като цяло никой не говори за него – като изключим редовните шаблонни фрази, които всички механично използват.
Continue reading България *след* комунизма

Jorge Bucay

I remembered this story from Jorge Bucay recently and I was willing to have it here if I decide to recall it again at some time, because it was not easy to find it on the Internet 😀


Mum had left early in the morning and left them with Marina, an eighteen year old girl that she used to hire every now and then to take care of them for a few pesos.
Continue reading Jorge Bucay

Magento Grid View Debug

In order to check if everything is working properly in your grid view you maybe will be willing to check that the SQL statements look as you expected:

Way to do that in Magento is $collection -> load(true); to the _prepareCollection() of the Grid view that you want to debug
Continue reading Magento Grid View Debug

Magento status and created_at grid view issues

Have you ever tried to change the Magento Grid View collections to a custom selects and joins?

For example you want your Invoice Grid to take some columns from the Order table:


Continue reading Magento status and created_at grid view issues

Magento join – EAV and Flat table

Case 1: After the Magento join, we want to have a EAV Collection as a result collection

//the ‘1’ is just a example of a where clause, you can totally miss this part, if you do not need it :)

$collection = Mage::getModel('catalog/product_link')

Continue reading Magento join – EAV and Flat table

Magento Architecture – Blocks, Models, Helpers

Magento is structured from many small modules working and existing as atomicly as possible. The typical Magento architecture for each module is divided on Blocks, Models, Helpers.

Tips: If you want to see more about most Magento interesting configuration one good class for that is core/code/Mage/Core/Model/Config.php

Now the interesting part have you thought why there are Mage::getModel(”) and Mage::getResourceModel(”) but Mage::helper?

Well, I still have not answer to that question. XD

But I have thought a lot of why you are able to get Mage::helper(‘unique_name’) but you able only to that -> Mage::getModel(‘unique_name/filename’) for the models.

Well, the answer is easy and it is in core/code/Mage/Core/Model/Config.php

public function getModelClassName($modelClass) {
    $modelClass = trim($modelClass);
    if (strpos($modelClass, '/') === false) {
        return $modelClass;
    return $this->getGroupedClassName('model', $modelClass);

public function getHelperClassName($helperName) {
    if (strpos($helperName, '/') === false) {
        $helperName .= '/data';
    return $this->getGroupedClassName('helper', $helperName);

In the helper one Magento configuration adds automatically /data if there is no slash in the $helperName so if you write something from this kind Mage::helper(‘unique_name’) it is presenting Data.php file in your Helper folder that this unique_name is defining it will be loaded automatically.

Magento Admin Redirect

How can you redirect the user request from your custom module to Magento Admin Core module?

If my module is in the local or the community pool and we want to redirect an action from the controller in our module to a controller in the core module the easiest way to make that Magento Admin redirect is:

public function someAction() {
    //general syntax $this->_redirect("adminhtml/module/action", params)
    $this->_redirect("adminhtml/sales_order/view", array('order_id', '11'));

JQuery Multiselect – Abbreviation List

Recently I had a struggle with jQuery Multiselect Widget.

As general it is really flexible and easy to use, but I was willing to have a list with abbreviation of all selected values (separate with commas)

More or less it should look like that at the end:

Continue reading JQuery Multiselect – Abbreviation List