sectheater/marketplace
Composer 安装命令:
composer require sectheater/marketplace
包简介
The Fluent Laravel E-commerce system
README 文档
README
the marketplace CheatSheet will be availble soon
marketplace provides you the following :
1. Product & Product Variation System
Create simple products, and complex ones using variation system by attaching the product to a specific type.
2. Coupon System
Generate , Validate , and purchase them while checkout easily.
3. Wishlist / Cart System
- CRUD the wishlist/cart easily
- get the total/subtotal of the whole cart/wishlist and optionally after sale/coupons applied.
- stock handling behind the scenes .
4. Category System
- Attach product, type of products to a category.
5. Sale System
- Setup sale for category, specific product, type of products.
6. Authorizing Users & Managing Roles.
Installation Steps
1. Require the Package
After creating your new Laravel application you can include the marketplace package with the following command:
composer require sectheater/marketplace:dev-master
2. Add the DB Credentials & APP_URL
Next make sure to create a new database and add your database credentials to your .env file:
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
You will also want to update your website URL inside of the APP_URL variable inside the .env file:
APP_URL=http://localhost:8000
3. Getting Your Environment Ready.
Just Run The following command.
php artisan sectheater-market:install
Command Interpretation
- The command just publishes the marketplace's config, migrations,helpers and seeder.
Notice : You may need to run the autoload composer command to reload the changes.
composer dump-autoload -o
Another Notice : Don't forget to delete the default users table migration, as marketplace ships with a default one as well.
4. Sample Usage
4.1 Creating a Product with Variation.
Product::generate([ 'user_id' => auth()->id(), 'name' => 'laptop', 'description' => 'Fancy laptop', 'price' => 15000, 'category' => 'electronics', 'type' => ['name' => 'MacBook Pro', 'stock' => 20], 'details' => ['color' => 'Silver', 'dummy-feature' => 'dummy-text'] );
4.2 Filter products by criteria.
Product::fetchByVariations(['locations' => 'U.K', 'variations' => ['size' => 'XL', 'color' => 'red'], 'categories' => 'clothes']);
- Add custom Criterion and use it while searching.
4.3 get Cart total/subtotal.
Out of the blue, you may use a couple of methods to retrieve the total/subtotal
Cart::subtotal(); Cart::total(); // returns total after applying tax. Cart::total($coupons); // Collection of coupons passed, returns total after applying tax and coupons. Cart::subtotalAfterCoupon($coupons);
Suprisingly every single method you can use for a cart, you can use for a wishlist ( since we can consider it as a virtual cart )
4.4 get Cart item .
Cart::item(1); // get the item with id of 1 Cart::item(1, ['color' => 'blue', 'size' => 'L']); // get the item with the id of 1 and should have these attributes. Cart::item(null, ['color' => 'blue','size' => 'L']); // get the current authenticated user's cart which has these attributes assuming that these attributes identical to the database record. Cart::item(null, ['color' => 'blue','size' => 'L'] , 'or'); // get the current authenticated user's cart which has any of these attributes.
4.4 Generate Coupons.
Coupon::generate([ 'user_id' => auth()->id(), 'active' => true, 'percentage' => 10.5, 'expires_at' => Carbon::now()->addWeeks(3)->format('Y-m-d H:i:s') ]);
4.5 Validate Coupons.
$coupon = Coupon::first(); // valid one Coupon::validate($coupon); // returns true
4.6 Deactivate Coupons.
$coupon = Coupon::first(); Coupon::deactivate($coupon->id);
4.7 Purchas Coupons.
$coupon = Coupon::first(); Coupon::purchase($coupon); // Purchase the coupon for the current authenticated user. Coupon::purchase($coupon, $anotherUser); // Purchase the coupon for the passed user.
4.7 Purchased Coupons.
- It releases the invalid purchased coupons automatically.
Coupon::purchased(); // returns the only valid purchased coupons.
4.8 Apply Specific Coupons.
- Assuming the user has a couple of coupons, he can designate which of them that can be applied on a specific product.
Coupon::appliedCoupons($coupons); // returns a query builder.
For more, you can view the docs.
sectheater/marketplace 适用场景与选型建议
sectheater/marketplace 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 657 次下载、GitHub Stars 达 206, 最近一次更新时间为 2018 年 10 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Laravel shopping cart」 「laravel e-commerce」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sectheater/marketplace 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sectheater/marketplace 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sectheater/marketplace 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel 11 and above Shopping cart
Admin Hub for GetCandy. A modern headless e-commerce solution for Laravel PHP framework.
universal shopping basket
Google Shopping Feed API (with ns problem fixed)
A PHP (and Laravel) package to interface with the Snipcart api.
Yii2 extension that adds shopping cart functions
统计信息
- 总下载量: 657
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 206
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-15