Download the PHP package chriskonnertz/open-graph without Composer

On this page you can find all versions of the php package chriskonnertz/open-graph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package open-graph

Open Graph Builder

Build Status Monthly Downloads Version GitHub license

Library that assists in building Open Graph meta tags.

Installation

Add chriskonnertz/open-graph to composer.json with a text editor:

Or via a console:

In the future use composer update to update to the latest version of Open Graph Builder.

This library requires PHP >=7.0.

Framework Support

Laravel >=5.5 can auto-detect this package so you can ignore this section. In Laravel 5.0-5.4 you have to edit your config/app.php config file. You can either add an alias to the object so you can create a new instance via new OpenGraph() ...

...or an alias to the facade (this is what happens in Laravel >=5.5 via package auto-discovery) so you do not have to create the instance by yourself but you can access it via pseudo-static methods. If you choose this path you also have to add the service provider to the config file:

If you need to reset the underlying instance of the facade (the OpenGraph object), call OpenGraph::clear().

Introduction

Example:

Render these tags in a template as follows:

Providing Open Graph tags enriches web pages. The downside is some extra time to spend, because every model has its own way to generate these tags. It's also important to follow the official protocol. Read the documentation to learn more about the tags that are available and the values they support or check out examples. Please note that this implementation sticks to the specification of OGP.me and does not support the enhancements created by Facebook.

Add Tags And Attributes

Add Basic Tags

If no argument is passed to the url method the current URL is applied. Note that the environment variable APP_URL is considered if it is set. Furthermore, when executed via CLI, and APP_URL is not set, the domain will be localhost.

Note that DateTime objects will be converted to ISO 8601 strings.

Add Tags With Attributes

You may add image, audio or video tags and pass the basic value (the URL to the object) and an array of additional attributes.

Add Type Attributes

Some object types (determined by the type tag) have their own tags with attributes but not a basic tag. These are article, book and profile.

Add Attributes

Facebook supports more than just the basic object types. To add attributes for off-the-record object types you may use the attributes method.

Without custom validation rule:

With custom validation rule:

The only validation this method performs is to check if all attribute names match with the list of attribute names.

Add A Tag Several Times

A property can have multiple values. Add the tag several times to achieve this effect.

Adding a basic tag a second time will override the value of the first tag. Basic tags must not exist several times.

Validation

If validation is enabled (default is disabled) adding tags will trigger validation. Validation is not covering the complete specification but some important parts. If validation fails the method will throw an exception.

Validation checks if tag values are legit and if attribute types are known.

Enable validation by method:

By constructor:

Disable validation:

Miscellaneous

Determine If A Tag Exists

Remove A Tag From The List

Remove All Tags From The List

Add A Custom Tag

To disable auto-prefixing pass a third parameter: $og->tag('apples', 7, false)

Get The Last Tag (By Name)

Tags are stored as arrays consisting of name-value-pairs.

Status

Status of this repository: Maintained. If you create an issue you will get a response usually within 48 hours.


All versions of open-graph with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chriskonnertz/open-graph contains the following files

Loading the files please wait ....