Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



36 Commits

Repository files navigation

JSON to HTML <head> for PHP (json2htmlhead)

HTML <head> element generator from JSON for PHP

Application generates elements from defined JSON.

JSON supports two directories. One for development and one for release. If you are using in your project only one directory, write same data for both objects - dev and release. This structure is optional. You can omit any property. It will automatically filled with empty string.

JSON supports The Open Graph protocol ( User must update <html> element to <html lang="en" prefix="og:">.

Application overview

  • user can define unlimited fonts
  • user can define unlimited libraries
  • user can define unlimited RSS
  • user can define unlimited CSS files
  • user can define unlimited meta elements
  • user can define own unlimited content meta information via "content" : {"name" : "contentValue" }
  • user can override keywords, description and title via constuctor arguments

How to run JSON to HTML head for PHP

include_once 'app/php/inc/page-header.php';

How to set own URL for JSON data

User can set own URL for JSON data:

$hg = new HeaderGenerator();

Testing release version

Use query string release=true in URL and you can test header generated from release data. e.g. http://localhost:8000/app/index.php?release=true

Developers are using separated directories for dev version and release/build/app version. Build version is deployed on server and URL is changed from localhost to domain name.

In this case are used release JSON data. If you want to test build version on localhost before server upload, use query string release=true.