A layer of ecommerce functionalities for Laravel
enriconardo/laravel-ecommerce-layer is a Laravel package for a layer of ecommerce functionalities for laravel.
It currently has 0 GitHub stars and 102 downloads on Packagist.
Install it with composer require enriconardo/laravel-ecommerce-layer.
Discover more Laravel packages by enriconardo
or browse all Laravel packages to compare alternatives.
Last updated
This is a work in progress project.
You can install the package via composer:
composer require enriconardo/laravel-ecommerce-layer:dev-master
If you decide to use subscriptions, in order to regularly check the subscriptions status and automatically renew or cancel them, you have to schedule the proper task in the file app\Console\Kernel.php of your application:
protected function schedule(Schedule $schedule): void
{
// You can schedule with the frequency you like
$schedule->job(new \EcommerceLayer\Jobs\RenewSubscriptions)->hourly();
}
php artisan vendor:publish --provider="EcommerceLayer\Providers\ServiceProvider" --tag=config
/** @var \EcommerceLayer\Gateways\GatewayProviderInterface $gateway */
$gateway = gateway('your_gateway_identifier');
Laravel Ecommerce Layer doesn't implement an authentication flow, this should be a responsability of the main application where it is installed.
In order to set an authentication guard, add the right middleware to the group of middlewares attached to the Laravel Ecommerce Layer routes by updating the configuration file. First of all publish the configuration file, like reported here, then change the following attribute:
# File config/ecommerce-layer.php
'http' => [
'routes' => [
'middlewares' => [
'api', // Don't remove this unless it is really necessary
'your-custom-middleware' // E.g: auth:api
],
]
],
A gateway package is composed by a set of classes:
\EcommerceLayer\Gateways\GatewayProviderInterface\EcommerceLayer\Gateways\PaymentServiceInterface\EcommerceLayer\Gateways\CustomerServiceInterfaceIn order to enable the gateway, just add the following line of code in the register function of one of your service provider:
/**
* Register the application services.
*/
public function register()
{
// ...
// Enable the gateways
$this->app->make(GatewayProviderFactory::class)->enableGateway(new YourMainClass);
// ...
}
YourMainClass is your actual Main class described before.
Then you need to add a proper record in the database, to do this just type the following command:
php artisan ecommerce-layer:gateway:create {name} {identifier}
Where name is a label for your Gateway (eg: Stripe) and identifier is a value for the system to distinguish it from others (eg: your-identifier). Do not use spaces.
ISO standards for currencies, countries, languages and HTTP status codes are handled by PHP enums of the prinsfrank/standards package. Check it on Github.
In the Laravel Ecommerce Layer, the ISO standards used are:
The MIT License (MIT). Please see License File for more information.