2 COMMENTs
PHP
Bruno Skvorc, Aug 08

6 More Must-Do Grav Tweaks: Ready for Hacker News Traffic!

Super-caching, optimization, customization, comments, and much more you simply MUST do for your Grav installation
24 COMMENTs
PHP
Wern Ancheta, Jul 22

Can We Use Laravel to Build a Custom Google Drive UI?

Wern Ancheta builds a brand new Google Drive admin UI with Laravel!
7 COMMENTs
PHP
Christopher Pitt, Jul 06

PHP, Arduino And... Minecraft? Combining Minecraft with PHP!

Chris Pitt combines Minecraft and PHP to prime the ground for an Arduino implementation, culminating in a real world alarm for a Minecraft door!
8 COMMENTs
PHP
Christopher Pitt, Jun 03

Hacking the Fitbit - Emulating a Pager for Twitter DMs!

Chris makes his cheap Fitbit vibrate on new Twitter DMs - emulated pager AND a silent wake-up alarm? WIN!
4 COMMENTs
PHP
Bruno Skvorc, Jun 01

Nitpicking over Code Standards with Nitpick CI

Nitpick CI is a service with a singular purpose - making sure your Github PRs respect the PSR-2 code standard. In this post, we'll put it to the test
2 COMMENTs
PHP
Wern Ancheta, May 13

We're Building a Marvel Catalog Reader! Avengers, Assemble!

In this tutorial, we're going to take a look at the Marvel API, a tool provided by Marvel for developers to get access to the 70-plus years of Marvel comics data.

Marvel logo

First, we'll walk through the steps in which one can acquire the keys needed to make requests to the API. Then, we'll look at the tools we can use to test out the API. Finally, we're going to build a website that uses the API.

Signing Up

The first thing we need to do is go to the Marvel Developer Website and click the Get a Key link. We'll then be provided with the public and private key which we can use to perform requests to the API. If you plan to use the project in production, you can also add your website's domain name to the list of authorized referrers. This provides a security layer in case you accidentally push your public and private keys to Github.

Important Notes Regarding the Use of the API

For limits and rules, please see the attribution, linking and rate limits page of their documentation. Also be sure to read the Marvel API Terms of Use if you're planning to use the API in production. I've summarized it below:

  • Beware of the API rate limit. At the time of writing of this tutorial the rate limit is 3000 calls per day. That's applicable to all the endpoints.
  • Always attribute Marvel as the source when displaying API data and images. Marvel recommends the use of this text: Data provided by Marvel. © 2016 Marvel.

Playing with the API

The API comes with an interactive documentation which allows you to easily test all the available API endpoints.

There's information on the data one can expect:

expected data

... text fields to specify the different parameters to be submitted for the request:

parameters

... error status codes:

error codes

... the request URL, response body, response code and the response headers:

request and response

Do note that the request URL won't actually return anything if you access it outside of the API testing tool. This is because it lacks the required parameters for the request. At the bare minimum, you'll have to supply the public key, the current unix timestamp, and an md5 hash of the timestamp, and private and public key combined.

<?php
$ts = time();
$public_key = 'your public key';
$private_key = 'your private key';
$hash = md5($ts . $private_key . $public_key);

Once you have those, only then can you perform a request to the API:

<?php
$query_params = [
    'apikey' => $public_key,
    'ts' => $ts,
    'hash' => $hash
];

//convert array into query parameters
$query = http_build_query($query_params);

//make the request
$response = file_get_contents('http://gateway.marvel.com/v1/public/comics?' . $query);

//convert the json string to an array
$response_data = json_decode($response, true);

We'll take a look at this in more detail when we get to the section where we start making requests for the app that we'll be building.

15 COMMENTs
PHP
Christopher Pitt, Apr 29

Starting a Business with Laravel Spark

Chris Pitt goes from zero to hero in a post detailing the process of building an actual business app from scratch with Laravel Spark!
5 COMMENTs
PHP
Christopher Pitt, Apr 22

What is SparkPost?

Chris Pitt looks at SparkPost, talks to their devangelist, and demonstrates a simple integration, building the foundation for more complex posts
1 COMMENT
PHP
Daniel Berman, Mar 14

Running an Elastic LAMP Stack on AWS

Daniel goes through the simple process of setting up a powerful LAMP stack on AWS with Zend Server, for high traffic cloud-safe web applications!
7 COMMENTs
PHP
Wern Ancheta, Feb 29

Building a Hacker News Reader with Lumen

Wern Ancheta builds a Hacker News reader with a local cache from nothing with the Lumen microframework!
3 COMMENTs
PHP
Christopher Pitt, Feb 24

Websockets in Your Synchronous Site

Chris introduces Socketize, a "sockets-as-a-service" layer that helps you implement websockets into apps with zero overhead, then adds them to a PHP script!
2 COMMENTs
PHP
Bruno Skvorc, Feb 15

Building Microsoft's What-Dog AI in under 100 Lines of Code

Here's how to use a popular AI engine to classify uploaded images of dogs into breeds - much like Microsoft's What-Dog app, but in only 80 lines of code!
2 COMMENTs
PHP
Reza Lavaryan, Jan 13

An in-Depth Walkthrough of Supercharging Apps with Blackfire

M. Lavaryen explains the Blackfire profiler in depth and demonstrates its use on a simple script, laying the groundwork for further exploration on your end!
1 COMMENT
PHP
Daniel Sipos, Jan 08

Crash Course of Wunderlist's API with Guzzle

Danny Sipos takes a break from Drupal to teach us about Wunderlist and it's (almost) brand new API - see how easy it is to build custom todo UIs!
10 COMMENTs
PHP
Bruno Skvorc, Jan 06

Setting up PHP 7 Servers with Laravel Forge and DigitalOcean

See how easy it is to set up PHP 7 servers with both Laravel Forge and a manual DigitalOcean setup!
3 COMMENTs
PHP
Younes Rafie, Jan 04

Introducing Bugsnag - the Last Error Monitor You'll Need

Younes introduces Bugsnag, an excellent professional error monitoring, reporting and parsing tool, and implements it into an old Laravel app.
1 COMMENT
PHP
Daniel Berman, Dec 09

Easy Continuous Delivery with ContinuousPHP and Zend Server

Daniel Berman presents a dead easy way of doing continuous delivery (integration + deployment) with the power of ContinuousPHP and Zend Server
6 COMMENTs
PHP
Wern Ancheta, Nov 25

Liking, Watchlisting and Uploading through Vimeo's API

Wern continues where he left off in the last part, and implements liking, watchlisting and uploading of videos into his Slim application!
1 COMMENT
PHP
Wern Ancheta, Nov 23

Building a Basic Video Search App with Vimeo's API and Slim

Wern goes through the process of building a sample video search application consuming Vimeo's API, using the Slim framework. Don't change the channel!
4 COMMENTs
PHP
Andrew Carter, Nov 02

How to Build a NASA Photo Gallery with Zend Expressive

Andrew Carter goes from nothing to full app in this tutorial, using Zend Expressive to build a PSR-7 friendly middleware-powered gallery app. Sci-Fi stuff!
4 COMMENTs
PHP
Bruno Skvorc, Oct 30

Powerful Custom Entities with the Diffbot PHP Client

Bruno demonstrates how easy it is to extend the default Diffbot PHP client and get it to fetch custom data from completely custom webpage types
18 COMMENTs
PHP
Wern Ancheta, Sep 25

How to Quickly Build a Chat App with Ratchet

Wern Ancheta shows you how easy it is to build a JavaScript + PHP chat app with Ratchet and some JS libraries. Just two files of PHP! Start messaging now!
6 COMMENTs
PHP
Wern Ancheta, Sep 18

Conquering Instagram with PHP and the Instagram API

Wern Ancheta takes a look at the Instagram API, and uses both Guzzle and a PHP client to access it - tune in and build your own Instagram app!
8 COMMENTs
PHP
Wern Ancheta, Aug 27

Voice controlled PHP apps with API.ai

Wern introduces API.ai, a service which allows you to tie voice control to your apps by recognizing natural language and applying callbacks to phrases