cosmos/metatag

A helpful library class for making HTML 'meta' tags.

v3.0.0 2020-01-04 03:52 UTC

This package is auto-updated.

Last update: 2024-05-04 15:36:10 UTC


README

A helpful library class for making HTML <meta> tags.

Install

composer require cosmos/metatag

Usage

Basic

use Cosmos\MetaTag\MetaTag;

$data = [
  'description' => "A helper class for making html meta tag.",
  'author' => 'John',
  'keywords' => ['PHP', 'Composer', 'Code', 'Github']
];

$metaTag = new MetaTag($data);

echo $metaTag->display();
// <meta property="description" content="A helper class for making html meta tag.">
// <meta property="author" content="John">
// <meta property="keywords" content="PHP,Composer,Code,Github">

Access Properties

use Cosmos\MetaTag\MetaTag;

$meta = new MetaTag($data);

// add or modify properties.
$meta->author = "James";
$meta->set('name', 'another content');

// get property.
$name = $meta->get('name');

// remove property
$meta->remove('name');

License

MIT License