2010-01-15 Version 0.3.0 released
You can create one, two and three words long meta keywords, meta description from a string or from an url.
It can calculate the most relevant keywords and can calculate the description by keywords.
$text = " Nam viverra odio et purus bibendum nec imperdiet elit fermentum. Sed fringilla tempus nunc ut convallis. Curabitur varius suscipit fringilla? Integer tristique lorem urna, tempus ultricies lacus. Pellentesque malesuada nunc nec risus adipiscing fermentum. Quisque nunc turpis, lobortis non auctor et, cursus non nisi. Praesent consectetur massa at metus rutrum rhoncus. Aenean viverra dolor nec arcu dapibus mattis. Donec mattis est non justo elementum interdum tincidunt mi pharetra! Curabitur viverra luctus eros sed aliquet. Suspendisse ornare, risus eget fermentum rhoncus, quam massa eleifend diam, nec rutrum magna nulla non lacus. Sed sodales, sapien ac ultrices sagittis, lacus neque iaculis urna; nec consequat magna lorem eget ipsum. Sed ut mi eu mauris lobortis hendrerit. Proin porttitor tellus ut velit pretium at sodales enim faucibus. Nam hendrerit, mauris non consequat placerat, ipsum dolor porttitor diam; ut facilisis urna purus vitae erat. Morbi vel diam in libero ultricies luctus quis eu quam. Quisque dui justo, laoreet et euismod eget, condimentum non risus. Mauris nec libero leo. Duis tincidunt euismod diam nec porta! "; $meta_options = array( 'maxDescriptionLength' => 150, 'minWordLength' => 3, 'maxKeywords' => 15, 'bannedWords' => array('foo', 'bar'), 'marks' => '.!?', 'maxTitleLength' => 70 ); $meta =& new HTML_MetaTags($meta_options); $meta->setText($text); $meta->setTitle('Lorem ipsum'); //it's optional echo $meta->getKeywords(); //only keywords echo $meta->getDescription(); //only description echo $meta->getTitle(); //only title print_r($meta->getMetaTags()); //all of them $meta2 =& new HTML_MetaTags($meta_options); $meta2->setUrl('http://pear.php.net'); echo $meta2->getKeywords(); //only keywords echo $meta2->getDescription(); //only description echo $meta2->getTitle(); //only title print_r($meta2->getMetaTags()); //all of them