2 COMMENTs
PHP
Younes Rafie, Sep 08

Laravel Quick Tip: Model Route Binding

Laravel has the option to bind models to routes, for easy auto-fetching. See how they can be configured, and how to switch to UUID instead of primary keys!
PHP
Wern Ancheta, Aug 26

How to Create a Pokemon Spawn Locations Recorder with CouchDB

Wern Ancheta shows you how to build a Pokemon spawn location recorder app with CouchDB and the Slim Framework, wrapping it up in good security practices!
23 COMMENTs
PHP
Bruno Skvorc, Aug 23

Up and Running with the Fastest PHP Framework on PHP7 in 5 Mins

Phalcon is back - and in style! It can now run on PHP 7, and is written completely in Zephir. Easy extension development AND perfect performance!
6 COMMENTs
PHP
Bruno Skvorc, Aug 05

8 Must-Have Grav Plugins to round-off Your Blog's Installation

A list of must-have Grav plugins to round off any developer's personal blog, plus some extra performance and quality tweaks.
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
Andrew Carter, Jul 13

Quick Tip: Testing Symfony Apps with a Disposable Database

Andrew explains how to perform database-related tests in a Symfony app much faster - with a disposable in-memory SQLite database, avoiding any bulky mocks
4 COMMENTs
PHP
Reza Lavaryan, Jun 29

Disco with Design Patterns: A Fresh Look at Dependency Injection

We build a basic framework with a new dependency injection container called Disco, explaining all the confusing concepts along the way. Join us!
5 COMMENTs
PHP
Bruno Skvorc, Jun 28

Sourcehunt: PHP7-Only Alternative to Laravel, HPKP, and More

This sourcehunt features a PHP-7 only alternative to Laravel, input validation, HPKP, strict PHP object signatures, and more.
11 COMMENTs
PHP
Bruno Skvorc, Jun 27

Can Symfony Apps Be Fast on Vagrant? Let's Check with SuluCMS!

In this tutorial, we go through some effective performance hacks for developing Symfony apps on Vagrant virtual machines
9 COMMENTs
PHP
Daniel Sipos, Jun 20

Your Own Custom Annotations - More than Just Comments!

Danny teaches you how to build Doctrine-style PHP annotations for your own custom projects!
17 COMMENTs
PHP
Francesco Malatesta, Jun 13

Laravel Doctrine - Best of Both Worlds?

Francesco introduces Laravel Doctrine, and builds a sample app with it - come learn about this powerful ORM + Framework mix!
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!
PHP
Bruno Skvorc, May 30

Sourcehunt: Conferences, Oauth2 in Slim, Static Analyzers, Etc.

Another sourcehunt is here! This time, we're featuring conference apps, personal project managers, oauth2 helpers, and more!
6 COMMENTs
PHP
Scott Molinari, May 18

Benchmarking: Can AppServer Beat Symfony's Performance?

Scott revisits Appserver and benchmarks it against Symfony to dispel the rumors of bas performance. Does he succeed? Tune in to find out!
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!
7 COMMENTs
PHP
Wern Ancheta, Apr 05

PredictionIO and Lumen: Building a Movie Recommendation App

Wern continues the movie prediction app building process, this time nelisting the full power of Lumen, ElasticSearch, and PredictionIO
1 COMMENT
PHP
Bruno Skvorc, Mar 21

Sourcehunt March 2016: PHP in Rust, Pathfinding, Eve Online

This sourcehunt features a no-framework framework, PHP running in Rust, a new microframework, pathfinding in PHP, and more
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!
PHP
Bruno Skvorc, Feb 26

Sourcehunt #4 - Reflection, Authorization, Crons, and more

The newest edition of sourcehunt presents 6 more promising packages that might find a home in your project one day. Help them grow by contributing!
10 COMMENTs
PHP
Francesco Malatesta, Feb 19

How to Consume Laravel API with AngularJS

Francesco builds an AngularJS app to consume a previously built Laravel API application for making book wishlists. JSON web token authentication in action!
65 COMMENTs
PHP
Francesco Malatesta, Feb 17

How to Build an API-Only JWT-Powered Laravel App

Francesco builds an entire API-only application with the Laravel API Boilerplate project (JWT edition) for creating and editing book wishlists!
3 COMMENTs
PHP
Younes Rafie, Feb 01

Building OctoberCMS Form Field Widgets like a Pro

Younes Rafie looks at building awesome OctoberCMS form field widgets for deeply customized inputs and making OctoberCMS a true business-worthy CMS
6 COMMENTs
PHP
Scott Molinari, Jan 29

Appserver - Server Configuration, Dir Structure and Threads

Scott revisits Appserver and teaches you how to set up an example application with a custom virtual server. Your apps have never been this fast!