reinvanoyen/oak-wishlist
Composer 安装命令:
composer require reinvanoyen/oak-wishlist
包简介
Wishlist for Oak
README 文档
README
A simple wishlist implementation for DRY applications
Installation
composer require reinvanoyen/oak-wishlist
Example usage
Prepare your item
<?php use Tnt\Wishlist\Contracts\WishlistItemInterface; class Product implements WishlistItemInterface { public static function getByWishlistId(int $id): ?WishlistItemInterface { // get the product by id } public function getWishlistId(): int { return 1; } public function serialize(): array { return [ 'id' => $this->getWishListId(), 'title' => 'Your wishlistable product #1', ]; } }
Use of the facade
<?php use Tnt\Wishlist\Facade\Wishlist; $product = new Product(); // Add an item Wishlist::add($product); // Remove an item Wishlist::remove($product); // Check if an item is wishlisted if (Wishlist::has($product)) { echo 'Yes, it is a wishlisted item!'; } // Retrieve all wishlisted items Wishlist::getItems(); // Clear all items from the wishlist Wishlist::clear();
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-08-13