Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Integrating Polymer/Dart and Symfony – Part 2
Jan 21, 2014 @ 19:05:11

On SitePoint's PHP blog Taylor Ren has posted the second part of his series looking at integrating Polymer/Dart and the Symfony framework to make a simple browser-based widget. The first part of the series can be found here.

If the server (and thus the configuration, the programming) is managed by ourselves, the process to get data from a RESTful API from that same server will be simple. We can enable CORS in the returned response header. Done! But if the remote server's RESTful API does not set that header, we will face a CORS error when we try to invoke that API call from within the Dart app.

He offers one solution - JSONP - but dismisses it because of its "hacky nature". Instead he opts to use the PHP (Symfony) side to grab the data from the remote feeds and pull it into the local domain for the widget to fetch. Code for both the client side and server side functionality are included as well as the HTML markup to create the page for the widget.

tagged: polymer dart tutorial symfony javascript part2 widget

Link: http://www.sitepoint.com/integrating-polymerdart-symfony-part-2

SitePoint PHP Blog:
Integrating Polymer/Dart and Symfony – Part 1
Jan 15, 2014 @ 16:43:31

On the SitePoint PHP blog today Taylor Ren shows you how to integrate the popular PHP framework Symfony with Polymer/Dart to make a dynamic web application. In this first part of the series, he focuses on just getting things set up and working and creating the first template to populate with data.

In this 2-part series, we are going to look at how to integrate these two powerful tools together, i.e. to run Dart (after compiling to JavaScript) in a Symfony website to add some dynamics. We will also discuss the work-around to avoid JSONP to access data from a remote server where the user has no direct control and the RESTful API called has no CORS enabled. Finally, we will highlight the limitation of the integration and seek the attention of the Dart team to solve the issue and make Dart a better platform.

He starts off with the server-side of things, using Symfony to create a simple template for the site used by the default controller. He then moves to the client-side, showing how to bootstrap Dart and include the resulting Javascript into the page. He includes the markup to add to the page to make things work and the results of his simple "Quote of the Day" application.

tagged: polymer dart tutorial symfony javascript part1

Link: http://www.sitepoint.com/integrating-polymerdart-symfony-part-1

SitePoint PHP Blog:
Dart and PHP: A Legacy Animal Guess Game
Dec 10, 2013 @ 17:54:40

The SitePoint PHP Blog has a new tutorial posted today showing an interesting combination of technologies to create a simple Animal Guesssing Game - using Dart as the frontend and PHP as the backend.

Back when I was learning programming on Apple II using BASIC, there was an Animal Guess Game. This game was a very primitive AI game: the computer tries to ask a few YES/NO questions and receives the answer from the user. Based on the answer, it may ask more Y/N questions until it tries to guess the animal. In this tutorial, we will learn how to re-vitalize this program using PHP as backend and Dart as frontend. Of course, a database will be used to store all the questions and guesses of animals.

He walks you through the database setup (including table definitions) and provides some simple PDO-based code to connect and fetch results. Then comes the Dart frontend. He goes through the installation and configuration and how to make a new Polymer application, also including the markup and Dart code to make the backend connection.

tagged: dart animal guess game backend frontend tutorial

Link: http://www.sitepoint.com/dart-php-legacy-animal-guess-game


Trending Topics: