1. Go to this page and download the library: Download lenius/laravel-ecommerce 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/ */
lenius / laravel-ecommerce example snippets
namespace App\Basket;
use App\BasketItem;
use Lenius\Basket\ItemInterface;
use Lenius\LaravelEcommerce\Contracts\ItemFactoryInterface;
class BasketItemFactory implements ItemFactoryInterface
{
public function create(array $data, string $identifier): ItemInterface
{
$item = new BasketItem($data);
$item->setIdentifier($identifier);
return $item;
}
}
use App\Basket\BasketItemFactory;
use Lenius\LaravelEcommerce\Contracts\ItemFactoryInterface;
public function register(): void
{
$this->app->bind(
ItemFactoryInterface::class,
BasketItemFactory::class,
);
}