Categories
PHP

phpSEO – Class for better SEO in PHP

UPDATED v1.0 21-02-2014

Usage:

seo::$charset = 'UTF-8'; //optional by default is always UTF-8
$title = seo::text($this->template->title, 70);//before I was not using it for title but I think it's important
$meta_keywords = seo::keywords($this->template->meta_description);
$meta_description = seo::text($this->template->meta_description);

The phpSEO class download.

OLD Doc: DO NOT USE!

I’ve been working all the free time I had this week in the class to make better SEO in your PHP

Few days a go I posted about some SEO functions for PHP but was still too many things to improve.

Basic usage:

$seo = new phpSEO("some long text here");
$keywords = $seo->getKeyWords();
$desc = $seo->getMetaDescription();

Advance usage:

$seo = new phpSEO("some long text here");
$keywords = $seo->getKeyWords(5);//returns only 5 keys
$desc = $seo->getMetaDescription(100);//returns 100 chars

Expert mode:

seo = new phpSEO();
$seo->setText(file_get_contents("https://garridodiaz.com"));//reading content form file or url
echo $seo->getText();//prints the text
$seo->setDescriptionLen(150);//description 150 chars
echo $seo->getMetaDescription();//print description
$seo->setBannedWords("sed,non,libero");//banned words, override the existing ones for keywords
$seo->setMaxKeywords(10);//sets 10 the max keywords
$seo->setMinWordLen(5);//all the words with len less than 5 will be erased
echo $seo->getKeyWords();//returns the keys