GithubHelp home page GithubHelp logo

tenq / codeigniter-schemas-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scombat/codeigniter-schemas-library

0.0 2.0 0.0 29 KB

CodeIgniter Schemas Library give some helpfull shortcuts to build google's custom structured-data.

License: Apache License 2.0

PHP 99.28% HTML 0.72%

codeigniter-schemas-library's Introduction

CodeIgniter-Schemas-library

####CodeIgniter Schemas Library gives some helpfull shortcuts #####to build google's custom structured-data like :

  • Organization's Logo in search results and the Knowledge Graph.
  • Corporate Contacts informations.
  • Social profiles informations.
  • Google breadcrumbs and site name.
  • Rich Snippets for :
  • Products [latest]

#####And in the near future :

  • Promotion events for :
    • Performers aborted for rich snippets features (suggested more important by few users)
    • Venues
    • Ticketers
  • Rich Snippets for :
    • Recipes
    • Reviews
    • Events
    • Software Apps
    • Videos
    • Articles

#####In a more far away future :

  • A testing tool
  • A Preview and a live preview results
  • A website +
  • WYSIWYG Editor
  • Microdata support
  • RDFA support
  • Automatic generation support

Quick Start


######Let's get started ! First of all, we will load the Google Schemas's Library

$this->load->library('schemas');

######Now let's set the schema base

$this->schemas->set_type('Organization');
$this->schemas->site_name('Microsoft', 'My Beautifull schema site name', base_url());
$this->schemas->set_logo(base_url('my_fabulous_logo.png'));

What should look like:

alt text

We have now a basic schema's object. ######What do you think about add your social network profile ?

$this->schemas->add_social('https://www.facebook.com/castoretpollux/');
$this->schemas->add_social('https://twitter.com/castoretpollux_');
$this->schemas->add_social('https://www.linkedin.com/company/castor-&-pollux');
$this->schemas->add_social('https://instagram.com/stevejobs/');
$this->schemas->add_social('https://plus.google.com/+CastorPolluxParis/');

alt text

######Can we add a breadcrumb on google results ? Yes, very simply !

// Create a new breadcrumb
$this->schemas->create_breadcrumb();
$this->schemas->add_breadcrumb_item(1, current_url(), 'Schema');
$this->schemas->add_breadcrumb_item(2, site_url('/example'), 'Example');
$myFabulousBreadCrumb = $this->schemas->read_breadcrumb();

alt text

######Now, we add some contacts for our customers

$this->schemas->add_contact('0123456789', 'customer support');
$this->schemas->add_contact('0123456789', 'technical support', array("US","CA","MX"));
$this->schemas->add_contact('0123456789', 'billing support', false, 'HearingImpairedSupported');
$this->schemas->add_contact('0123456789', 'emergency', array("US","CA","FR"), 'TollFree', array("French", "English", "Spanish"));

######And if we removing a contact now ?

$this->schemas->remove_contact(1);

That's all ! You can call this method with all indexes of existing contact.

######Add a product rich snippet

$this->schemas->product_snippet_name("Executive Anvil");
$this->schemas->product_snippet_image("http://www.example.com/anvil_executive.jpg");
$this->schemas->product_snippet_description("Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.");
$this->schemas->product_snippet_code("mpn", "925872");
$this->schemas->product_snippet_brand("ACME");
$this->schemas->product_snippet_aggregateRating(4.4, 89);
$this->schemas->product_snippet_offers(119.99, "USD", "2020-11-05", "InStock");

// Get the result
$product = $this->schemas->read_product_snippet();

This methods do that :

alt text

######At the end, you'll want to get the schema, breadcrumb, sitename etc... For manipulate schema's object or json string before make all what you want with it.

If you want to get the object you have two options :

  • Modify the configuration file
  • Add parameter 'true' to the read_* methods.

Else if you want to get the string you have also two options:

  • Modify the configuration file
  • Add parameter 'false' to the read_*'s methods.
// Read breadcrumb
$breadcrumb = $this->schemas->read_breadcrumb();

// Read schema
$schem = $this->schemas->read_schema();

// Read Sitename
$this->schemas->read_sitename();

// Read Product rich snippet
$this->schemas->read_product_snippet();

codeigniter-schemas-library's People

Contributors

scombat avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.