Skip to content
Resources manager for: Js, CSS, Metatag, Open Graph. You can add and load resources with simple function.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src add factory May 5, 2019
.gitignore fixed composer and add comment Jan 5, 2019 add factory May 5, 2019
composer.json add factory May 5, 2019

Front Manager package

Frontend manager for: Js, CSS, Metatag, Open Graph. You can add and load resources with simple function.


Install with console command

composer require kosmosx/frontend

Or add in composore.json one of:

"kosmosx/frontend": "~1" // version >=1.0.0 <2.0.0

"kosmosx/frontend": "1.0.*" // version >=1.0.0 <1.1.0

Support (If you use a smaller version, compatibility is not guaranteed)

Add provider in config file app.php (if Laravel)

'providers' => array(

Register provider in bootstrap file (if Lumen)


$app->withFacades(); //uncomment if you want to use the Facades of the package

Let's go

Basic usage

$resources = (new FrontendFactory())->scripts();
$resources = new ScriptsFrontend();

$resources->add('', array(),'head.jquery')
    ->add('', array("type"=>"script"),'footer');

'head.jquery': head it is the context where the resource should be loaded inside the DOM (if omitted, body is used by default); jquery is the name of resource (not reuqired) Render tags

$resources->dump() //render all script tags

    <script src=""></script>
    <script src="" type="script"></script>

All method of FrontendInvoker

$resources->add(...)        //push in resources new element
          ->dump(...)       //render resources element
          ->has(...)        //find element in resources
          ->forget(...)     //forget element in resources

Function of services(Resource and Metatag)

->exist($resource, $context, $name) //$resource (script, js, og, meta etc..)
                                  //$context (body,footer etc..) if metatag service only 'head'
                                  //$name (name of resources) if metatag service name of type

->delete($resource, $context, $name)
->setContext()                    //add extra context to default
->cleanText()                     //clean string (remove tag and special charter)


$openGraph = new OpenGraphFrontend();                       //create with Service
$openGraph = new FrontendInvoker(new OpenGraphFrontend());  //create with invoker that use command
$openGraph = (new FrontendFactory())->opengraph();          //create with Factory that use invoker

$openGraph->add('title', 'Resources Manager')->add('description', 'Og description');

return $openGraph->dump();
    <meta property="og:title" content="Resources Manager"></meta>
    <meta property="og:description" content="Og description"></meta>

return $openGraph->dump('og:title');
        <meta property="og:title" content="Resources Manager"></meta>


The pull requests will be reviewed (document the code or write a detailed comment) and if successful they will be accepted

Write to or create an issue.

You can’t perform that action at this time.