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

SitePoint PHP Blog:
Using GDELT 2 with PHP to Analyze the World!
Dec 12, 2016 @ 12:16:15

The SitePoint PHP blog has a tutorial posted by Patrick van Bergen showing you how to analyze the world using a combination of PHP and the data from the GDelt (Global Database of Events, Language and Tone) database.

Are you interested in political world events? Do you want to play with one of the world’s largest databases? If you answered either of those questions with a yes, keep reading – this will interest you! This article follows up on the promise to use GDELT with PHP.

I will show you a simple example of how to use GDELT through BigQuery with PHP, and how to visualize the results on a web page. Along the way, I will tell you some more about GDELT.

He starts by briefly introducing the GDelt service, what kind of data it contains and how to make some sample queries with their BigQuery dashboard. He then moves more into the code, talking about some of the basic concepts of the data and setting up an account you can use for your queries. The example code uses the Google Cloud library to access the API and execute the query. Included are examples of querying metadata, the different datasets available and some visualization examples.

tagged: gdelt analyze world data bigquery tutorial googlecloud api

Link: https://www.sitepoint.com/using-gdelt-2-with-php-to-analyze-the-world/

SitePoint PHP Blog:
Exploring Github’s Public Events with PHP and Google BigQuery
Jun 15, 2015 @ 13:10:14

The SitePoint PHP blog has a new tutorial posted showing you how to explore GitHubs public events through the GitHub API and handled via the Google BigQuery infrastructure taking the burden off your own systems.

If you’ve been following along with my previous articles about Github’s API, you know that Github’s developers are doing their best to ease the pain of interacting with Github data. In this article, we’re going to take a look at the Github public events API and we will build a small demo along the way.

They start off with a brief introduction to both GiHub events (like pushes, merges, etc) and the BigQuery system and the problem it solves. They use a stock Laravel framework-based application (on a Homestead Improved VM) and add in the Google API credentials and a BigQueryServiceProvider using Google's own client to make the connection. They also set up a middleware authentication mechanism to redirect the user if they're not authenticated. They then move over to the BigQuery side and show how to use it's web-based console to perform queries and view results. They then translate this over to a simple "top ten" query, listing the top repositories ordered by number of forks. Building on this, they add in a simple form that allows the user to specify the language to search for (PHP, Javascript, etc) and outputs the results via a Blade template.

tagged: google bigquery github event api tutorial topten forks

Link: http://www.sitepoint.com/exploring-githubs-public-events-php-google-bigquery/

SitePoint PHP Blog:
Google's BigQuery Provides Free Access to GDELT
Jun 03, 2014 @ 10:19:31

In this recent post to the SitePoint PHP blog Bruno Skvorc points out a recent announcement from Google that the GDELT database information is now available via their BigQuery functionality.

The Global Database of Events, Language and Tone is one of the largest datasets on the planet. It is the quantitative database of human society, relying on thousands of news sources from every corner of the globe dating back to 1979. [...] Google BigQuery, “Google’s powerful cloud-based analytical database service” is, basically, the world’s fastest SQL engine, and it’s completely free for any and all uses of GDELT. Due to the sheer power of BigQuery, you can get results on GDELT queries in near real-time and any permutation of fields and values you can think of won’t be enough to bog it down to a halt – unless you really mess things up and go against the grain.

He goes on to describe the GDELT database and what kind of information it contains. He also includes an example query and the kind of data it returns (screenshot). He also links to a PHP-based library that you can install via Composer and use API keys to access their search endpoints.

tagged: gdelt database bigquery access library sdk api

Link: http://www.sitepoint.com/googles-bigquery-provides-free-access-gdelt/