Sabre GDS SOAP Web Service with PHP Done Right

I recently had the opportunity to work with Sabre’s Global Distribution System SOAP web service. The Sabre GDS powers everything from hotel bookings, to flights and cruises. Most hotels and airlines add inventory into Sabre allowing booking agencies and travel websites to display this data to customers and book travel plans through the GDS. Sabre is old and some of its client systems look almost VAX like, so working with it can be difficult at times.

If you are reading this post you’ve probably concluded that PHPs native SOAP client cannot easily consume Sabre’s GDS web service. I gave up on it after about a day. I had gone this route to replace a pre-existing solution that resulted in socket timeout errors. The current solution for PHP developers floating around the internet is slow and unreliable. After digging deep into the PHP SOAP Client documentation I discovered a middle ground approach between consuming the WSDL (which doesn’t work) and writing raw socket connections (which barely works).

Customizing CakePHP 3 Form Helper

The Cake 3 form helper component’s default output isn’t super conducive to working with front-end frameworks like Bootstrap. Luckily the Cake 3 team provide us with a template system to change the default output. Here’s a quick example to get you going:

The above sample outputs the following HTML:

The Cake 3 template system is quite extensive, check it out.

Multiple Checkboxes and CakePHP3 CSRF Security Component

I’ve spent a bit of time over the last few months learning Cake 3 (currently RC-2). I’ve been having a heck of a time with the CSRF Component barking at me that my requests have been black holed. If you’ve used the CSRF at all you’ve no doubt received something like this:

The request has been black-holed Error: The requested address ‘/controller/action/1’ was not found on this server.

Well I finally figured it out. When dealing with multiple checkboxes to submit an array over HTTP POST, you will want to use the unlockField feature. The component clearly has problems with creating a hash from multiple checkbox elements with the same name. Here’s some example code to get you out of the black hole.


Sorting on Associated Models with the CakePHP3 Paginator Component

I was a bit stumped recently while attempting to sort on associated models using Cake 3’s paginator component. It would only sort on main models fields. After finally reading through ALL of the documentation I stumbled upon the “sortWhiteList” option. Cake makes you use this in order to sort on associated models. Say we have a Cities model, which has associations to a Counties and States model. To sort on the and field we would use the following configuration:

Now inside the PaginatorHelper these can be referenced as follows:


Vendors, Packagist, and Composer in CakePHP 3

New with CakePHP 3 is the recommended use of composer. Composer makes managing dependencies easier and updating packages easier as well. Packagist is a nice resource for finding packages, but I do think it could use a bit more work such as a comment system for packages. I had some difficulties at first adding packages using composer and getting them to load in my Cake3 project. I’ll break down two examples in this blog post so you can get up and running faster.