melbahja / seo

🐘 Simple PHP library to help developers 🍻 do better on-page SEO optimization 🤖
https://git.io/phpseo
MIT License
311 stars 47 forks source link

Add generate method to MetaTags, Schema and Robots #11

Closed MuhammadSaim closed 3 months ago

MuhammadSaim commented 2 years ago

Twig and other templating engines do not convert objects to a string add method generate() to generate string on demand anywhere in the template.

// schema
$schema->generate();

// metatags
$metatags->generate();

// robots
$robots->generate();
melbahja commented 2 years ago

We don't need a generate func since we have __toString method

marclaporte commented 1 year ago

@MuhammadSaim Thoughts?

MuhammadSaim commented 1 year ago

@marclaporte I was working on the Codeigniter 3 with Twig integrated and using this package need to return the string because Twig is not converting the object to a string with __toString(). Hence, I need a method that generates the string and I can pass it to the template engine and render it as a raw HTML. That's why I propose this.

Sorry new to OpenSource just learning the norms and rules of PRs Thanks