Posts

Showing posts with the label php

How to create Restful API in Zend Framework 2

Your ZF module just needs to provide Controller that speaks REST (for example RestfulController) and make sure that generated response will be formatted in JSON, in other words configure JSON rendering strategy. Below you can see an example controller. Note that it has convenient methods for to get all elements, single element, create/update and delete an element: use Zend\Mvc\Controller\RestfulController; class UserController extends RestfulController { public function getList() { return array("users" => array()); } public function get($id) { return array("id" => $id); } public function create($data) { return array("created" => "yes"); } public function update($id, $data) { return array("updated" => "yes"); } public function delete($id) { return array("deleted" => $i); } } When associating this controller to route, make sure to NOT use 'action' parameter. Otherwis...

Orion PHP Support demo

Image
If you're following Eclipse planet , you couldn't have missed Karol Gusak's weekly status reports about PHP support that's being built for Orion. If you still haven't tried PHP in Orion yourself, here's a little demo now on YouTube that nicely shows syntax highlighting, content-assist as well as overall PHP experience in Orion. Click below to check it now.

Extend Eclipse in JavaScript... or PHP :-)

Image
The JavaScript unit tests view for Eclipse I blogged last time, wouldn't be anything special, unless you're JavaScript guy. Except the fact that it's implemented in plain HTML+JavaScript for GUI part and business logic. Ah.. and it uses jQuery too, so I think I can label the view as an example of jQuery plugins for Eclipse :-) This has several advantages: - I don't need to know Java to extend Eclipse. This is great for such Eclipse IDE users as JavaScript, or PHP developers. - many things are easier to calculate in web languages, than Java. E.g. (running JS tests, running a web poll, etc.) - writing simple UI in HTML is dead easy. and you can use CSS :-) The main disadvantage is difficult communication with workbench. Java APIs are complicated and hard to map 1:1 in JavaScript, however for start I'm looking at exposing only few most useful features, like selection service. The inner workings are pretty simple. Some HTML is rendered by browser widget embedded in tra...