ricadesign/laravel-cart
Composer 安装命令:
composer require ricadesign/laravel-cart
包简介
Laravel shopping Cart
README 文档
README
Welcome to the Laravel Cart Package! This package provides a complete solution for adding cart functionality to your Laravel application. It also includes pre-configured endpoints so you can consume the cart quickly and easily.
Installation
You can install this package using Composer. Run the following command in your terminal:
composer require ricadesign/laravel-cart
You can publish the package configurations (useful if you plan to have full control), run the following command:
php artisan vendor:publish --provider="Darryldecode\Cart\CartServiceProvider\LaravelCart\CartServiceProvider" --tag="config"
php artisan vendor:publish --provider="Ricadesign\LaravelCart\LaravelCartServiceProvider" --tag="config"
Configuration
By default, the cart is stored in the user's session. However, if you want to change this configuration to store the cart in the database, you need to add the following line to the config/shopping_cart.php configuration file:
'storage' => 'Ricadesign\LaravelCart\DBStorage',
After configure storage, you must run:
php artisan migrate
In case you are using DBStorage, you can configure the number of days you want to remain the cart on database in config/laravel-cart.php configuration file:
'prunable_days' => 14,
In order to clear periodically the database_carts table you can include this line in schedule:
$schedule->command('model:prune', [ '--model' => [DatabaseStorageModel::class], ])->daily();
Endpoints
This package includes a set of pre-configured endpoints that allow you to manage the cart quickly and easily. The endpoints are protected by default authentication, so only authenticated users can perform actions on the cart.
GET /api/cart: returns the contents of the cart.POST /api/cart: adds a product to the cart. The request body must include the productid,name,price,quantityand optionally an array of options.PUT /api/cart: updates the quantity of a product in the cart.PUT /api/cart/increment: updates the quantity of a product in the cart.DELETE /api/cart: removes a product from the cart.
Contributions
If you want to contribute to this package, you can fork the repository on GitHub and send a pull request with your changes. We also appreciate you reporting any issues or bugs you find in the issues section of the repository.
ricadesign/laravel-cart 适用场景与选型建议
ricadesign/laravel-cart 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 308 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ricadesign/laravel-cart 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ricadesign/laravel-cart 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 308
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-18