承接 tallieutallieu/oak-wishlist 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tallieutallieu/oak-wishlist

Composer 安装命令:

composer require tallieutallieu/oak-wishlist

包简介

Wishlist for Oak

README 文档

README

A wishlist package for DRY/Oak applications.

It supports two storage drivers:

  • session: store wishlist item IDs in the Oak session.
  • database: store wishlist item IDs in the wishlist table through dry ORM.

Installation

composer require tallieutallieu/oak-wishlist

Register the service provider in your Oak application:

<?php

$app->register([
    \Tnt\Wishlist\WishlistServiceProvider::class,
]);

Configuration

Create or publish a wishlist config entry in your application config.

<?php

return [
    'driver' => 'database',
    'model' => \Tnt\Wishlist\Model\Wishlist::class,
    'identifier' => \app\model\User::class,
];
Option Default Description
driver database database or session.
model Tnt\Wishlist\Model\Wishlist::class dry ORM model used by the database driver.
identifier none Class bound as WishlistableInterface; required for the database driver.

The configured identifier class must implement Tnt\Wishlist\Contracts\WishlistableInterface.

<?php

use Tnt\Wishlist\Contracts\WishlistableInterface;

class User implements WishlistableInterface
{
    public function getWishlistIdentifier(): int
    {
        return $this->id;
    }
}

Database Revision

When wishlist.driver is database, WishlistServiceProvider registers a package migrator named wishlist.

Run the wishlist revision with Oak:

php oak migration migrate -m wishlist

To apply only the next pending wishlist revision:

php oak migration update -m wishlist

To inspect registered migrators and versions:

php oak migration list

The first wishlist revision creates the wishlist table with these columns:

  • id
  • created
  • updated
  • wishlist_class
  • wishlist_id
  • identifier

The revision also adds non-unique indexes for wishlist lookup performance. It does not add a unique constraint, so existing duplicate wishlist rows remain compatible.

Wishlist Items

Wishlistable items must implement WishlistItemInterface.

<?php

use Tnt\Wishlist\Contracts\WishlistItemInterface;

class Product implements WishlistItemInterface
{
    public static function getByWishlistId(int $id): ?WishlistItemInterface
    {
        return self::load($id);
    }

    public function getWishlistId(): int
    {
        return $this->id;
    }

    public function serialize(): array
    {
        return [
            'id' => $this->getWishlistId(),
            'title' => $this->title,
        ];
    }

    public function isWishlistable(): bool
    {
        return true;
    }
}

Facade Usage

<?php

use Tnt\Wishlist\Facade\Wishlist;

$product = Product::load(1);

Wishlist::add($product);
Wishlist::remove($product);

if (Wishlist::has($product)) {
    echo 'Product is on the wishlist';
}

$items = Wishlist::getItems();

Wishlist::clear();

Internal API Endpoints

The service provider registers these dry-internal-api routes:

Method Path Description
GET wishlist/items/ Return serialized wishlist items.
GET wishlist/toggle/ Toggle an item by class and id.
GET wishlist/add/ Add an item by class and id.
GET wishlist/remove/ Remove an item by class and id.
GET wishlist/clear/ Clear the wishlist.

The item mutation endpoints expect:

  • class: a class name implementing WishlistItemInterface.
  • id: the item ID passed to getByWishlistId().

Admin Manager

Tnt\Wishlist\Admin\WishlistManager is available as a minimal read-only dry ORM manager for existing admin integrations.

It is not auto-registered by the service provider. If an application wants it in an admin portal, register it in that application.

Development

This package follows the Docker workflow used by the DRY package ecosystem.

Start the Docker environment:

make docker

Run tests:

make test

Run PHPStan:

make phpstan

Format PHP files:

make yarn-install
make yarn-format

The Docker setup uses the PHP 8.4 DRY image, MySQL, Adminer, and Xdebug.

tallieutallieu/oak-wishlist 适用场景与选型建议

tallieutallieu/oak-wishlist 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 87 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「list」 「wishlist」 「oak」 「Favorites」 「Fav」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 tallieutallieu/oak-wishlist 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tallieutallieu/oak-wishlist 我们能提供哪些服务?
定制开发 / 二次开发

基于 tallieutallieu/oak-wishlist 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 87
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2021-03-24