Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agnostic Package #5

Open
vinicius73 opened this issue Feb 24, 2015 · 5 comments
Open

Agnostic Package #5

vinicius73 opened this issue Feb 24, 2015 · 5 comments

Comments

@vinicius73
Copy link
Member

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


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

@rombat
Copy link

rombat commented Mar 9, 2015

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

@vinicius73
Copy link
Member Author

@edbizarro
Copy link
Contributor

Quando finalizarmos os testes vou pra essa :D

@jakemitchellxyz
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants