1. Go to this page and download the library: Download coderabbi/virtuoso library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php
namespace My\Project\Name\Space;
use Illuminate\Support\ServiceProvider;
class ComposerServiceProvider
extends ServiceProvider
{
public function register()
{
$this->app['view']->composer('profile', 'My\Project\Name\Space\UserCountComposer');
}
}
php
namespace My\Project\Name\Space;
use Coderabbi\Virtuoso\Composer;
class MyFirstSimpleComposer
implements Composer
{
public function compose($view)
{
$view->with('myData', $this->getMyData());
}
private function getMyData()
{
// do your thing here
}
}