Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/izica/phalcon-meta-tags
Phalcon PHP Meta tags Service
https://github.com/izica/phalcon-meta-tags
meta-tags phalcon phalcon-meta-tags phalcon-php phalcon-php-framework phalconphp php php-library php7 seo seo-friendly seo-manager seo-meta tags
Last synced: 3 months ago
JSON representation
Phalcon PHP Meta tags Service
- Host: GitHub
- URL: https://github.com/izica/phalcon-meta-tags
- Owner: izica
- License: mit
- Created: 2017-01-11T11:10:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T00:59:40.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T22:22:48.330Z (3 months ago)
- Topics: meta-tags, phalcon, phalcon-meta-tags, phalcon-php, phalcon-php-framework, phalconphp, php, php-library, php7, seo, seo-friendly, seo-manager, seo-meta, tags
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 12
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-phalcon - Phalcon meta tags - Tools for work with meta tags. (SEO)
README
# About
Phalcon meta tags plugin for PhalconPHP.This plugin allows you to easily and flexibly customize the meta tags of your view.
If this plugin helped you, be glad to see your star, thank you.
Check out new validation package for PhalconPHP
https://github.com/izica/phalcon-validation* [Install](#Install)
* [Plugin functions](#Plugin-functions)
* [Usage](#Usage)
* [Register plugin as service](#Register-plugin-as-service)
* [Add data to your layout](#Add-data-to-your-layout)
* [Use service in controller, view or middleware(anywhere)](#use-service-in-controller-view-or-middlewareanywhere)
* [Example of output](#Example-of-output)# Install
```bash
composer require izica/phalcon-meta-tags
```# Plugin functions
```php
setTitle($title)
getTitle()
setByProperty($property, $content)
unsetByProperty($properties) //array or single property namesetByName($name, $content)
unsetByName($properties) //array or single namesetCustom($key, $attributes) //unique key and attributes array
unsetCustom($keys) //array or single value
getMeta() // return metas string
```# Usage:
## Register plugin as service:
```php
$di = new DI();
$di->set('metatag', function() {
return new IzicaMetaTags();
});
```## Add data to your layout:
```php
metatag->getTitle();?>
metatag->getMeta();?>
getContent(); ?>
```## Use service in controller, view or middleware(anywhere):
```php
use Phalcon\Mvc\Controller;class IndexController extends Controller
{
public function indexAction()
{
$this->metatag->setTitle("Phalcon MetaTags Service");$this->metatag->setCustom("charset", ['charset' => 'UTF-8']);
$this->metatag->setCustom("http", ['http-equiv' => 'content-type', 'content' => 'text/html; charset=UTF-8']);$this->metatag->setByName("description", "phalcon php metatags");
$this->metatag->setByProperty("og:description", "When Great Minds Don’t Think Alike");
}
}
```## Example of output:
```html
Phalcon MetaTags Service
```