seotools icon indicating copy to clipboard operation
seotools copied to clipboard

Agnostic Package

Open vinicius73 opened this issue 9 years ago • 5 comments

Transforming the package in a package that does not depend on Laravel.


Transformar o pacote em um pacote que não dependa do Laravel.

vinicius73 avatar Feb 24 '15 01:02 vinicius73

That would be great! I'd like to use this package for Laravel 4.2 actually.

rombat avatar Mar 09 '15 17:03 rombat

@rombat you can use https://github.com/vinicius73/SeoTools

vinicius73 avatar Mar 09 '15 17:03 vinicius73

Quando finalizarmos os testes vou pra essa :D

edbizarro avatar May 01 '16 23:05 edbizarro

All you would have to do is remove all of the laravel helper functions (like array_forget() and array_get()) -- or better yet, include those functions in your own helpers.php file and include them via composer.json like:

"files": [
    "src/resources/helpers.php"
]

but once all of the helper functions are taken care of, the package is already agnostic. Someone not using Laravel could simply not register the service provider or alias, and use:

<?php
use Artesaos\SEOTools\SEOTools as SEO;

class SomeClass
{
    public function generateView()
    {
        SEO::setTitle('Home')->setDescription('Welcome to my website!');
        echo SEO::generate();
    }
}

obviously, that's an odd example, but it shows that a user can already use the package without Laravel. This is because the only thing Laravel is used for is setting up the Aliases and config (I am remove the config in my next pull, so if that is accepted, you won't have to worry about the config)

jakemitchellxyz avatar Jun 27 '16 15:06 jakemitchellxyz

^^ As a matter of fact, someone using Laravel can even use the package without the Service Provider (once the config is gone)

jakemitchellxyz avatar Jun 27 '16 15:06 jakemitchellxyz