src/Font/Font.php
protected function getFontViaAPI($api_key = '')
    {
        if (empty($api_key)) {
            return false;
        }

        // Get file contents from cache
        if (file_exists($fonts_from_cache = OLH_CACHE.'font-via-google-'.$api_key.'.php')) {
            return include $fonts_from_cache;
        }

        // Retrieve data from Google
        $context = stream_context_create(['http' => ['ignore_errors' => true]]);
        $json = file_get_contents('https://www.googleapis.com/webfonts/v1/webfonts?key='.$api_key.'&sort=popularity', false, $context);
        $data = json_decode($json, true);

        //Check errors
        if (isset($data['error'])) {
            // Write in file
            file_put_contents($fonts_from_cache, "<?php\n\n/**\n * This file is auto-generated from GetOlympus/Font vendor\n */\n\nreturn false;\n");
            return false;
        }

        // Get JSON fonts in array format
        $fonts = [];

        // Check items
        if (empty($data) || !isset($data['items']) || empty($data['items'])) {
            // Write in file
            file_put_contents($fonts_from_cache, "<?php\n\n/**\n * This file is auto-generated from GetOlympus/Font vendor\n */\n\nreturn false;\n");
            return false;
        }

        // Iterate
        foreach ($data['items'] as $font) {
            // Set vars
            $key = strtolower(str_replace(' ','_',$font['family']));
            $name = str_replace(' ','+',$font['family']);
            $sizes = '';

            // Check sizes from "files" node
            if (isset($font['files']) && !empty($font['files'])) {
                foreach ($font['files'] as $k => $n) {
                    $s = 'regular' == $k ? '400' : ('italic' == $k ? '400'.$k : $k);
                    $sizes = ('' == $sizes ? '' : ',').$s;
                }
            }

            // Build font
            $fonts[$key] = [
                'name'  => $name,
                'title' => $font['family'],
                'sizes' => $sizes,
            ];
        }

        // Write in file
        file_put_contents($fonts_from_cache, "<?php\n\n/**\n * This file is auto-generated from GetOlympus/Font vendor\n */\n\nreturn ".var_export($fonts, true).";\n");

        return $fonts;
    }
protected function getFontViaAPI($api_key = '')
    {
        if (empty($api_key)) {
            return false;
        }

        // Get file contents from cache
        if (file_exists($fonts_from_cache = OLH_CACHE.'font-via-google-'.$api_key.'.php')) {
            return include $fonts_from_cache;
        }

        // Retrieve data from Google
        $context = stream_context_create(['http' => ['ignore_errors' => true]]);
        $json = file_get_contents('https://www.googleapis.com/webfonts/v1/webfonts?key='.$api_key.'&sort=popularity', false, $context);
        $data = json_decode($json, true);

        //Check errors
        if (isset($data['error'])) {
            // Write in file
            file_put_contents($fonts_from_cache, "<?php\n\n/**\n * This file is auto-generated from GetOlympus/Font vendor\n */\n\nreturn false;\n");
            return false;
        }

        // Get JSON fonts in array format
        $fonts = [];

        // Check items
        if (empty($data) || !isset($data['items']) || empty($data['items'])) {
            // Write in file
            file_put_contents($fonts_from_cache, "<?php\n\n/**\n * This file is auto-generated from GetOlympus/Font vendor\n */\n\nreturn false;\n");
            return false;
        }

        // Iterate
        foreach ($data['items'] as $font) {
            // Set vars
            $key = strtolower(str_replace(' ','_',$font['family']));
            $name = str_replace(' ','+',$font['family']);
            $sizes = '';

            // Check sizes from "files" node
            if (isset($font['files']) && !empty($font['files'])) {
                foreach ($font['files'] as $k => $n) {
                    $s = 'regular' == $k ? '400' : ('italic' == $k ? '400'.$k : $k);
                    $sizes = ('' == $sizes ? '' : ',').$s;
                }
            }

            // Build font
            $fonts[$key] = [
                'name'  => $name,
                'title' => $font['family'],
                'sizes' => $sizes,
            ];
        }

        // Write in file
        file_put_contents($fonts_from_cache, "<?php\n\n/**\n * This file is auto-generated from GetOlympus/Font vendor\n */\n\nreturn ".var_export($fonts, true).";\n");

        return $fonts;
    }
Return all available Google fonts from API.
Retrieve the +800 fonts right? Uh... Maybe there is an other way with a search box.
That's an idea to keep in mind as @todo.

@param   string  $api_key
@return  array   $fonts