承接 creode/personalised-data 相关项目开发

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

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

creode/personalised-data

最新稳定版本:1.0.2

Composer 安装命令:

composer require creode/personalised-data

包简介

Creates a new hookable endpoint allowing you to populate personalised user data through a single url.

README 文档

README

This package is designed to be used on sites where dynamic data needs to be hydrated into the page at certain intervals. This is useful for sites that are built with a static site generator, or where the initial page load is slow due to the amount of data that needs to be loaded.

Installation

composer require creode/personalised-data

Usage

The package is designed to be used with a Laravel application. The package provides a Blade directive that can be used to define the data that needs to be loaded into the page after the initial page load.

Blade Directive

The Blade directive is @personalisedData and will handle the registration of the initialisation script and needs to be placed within your blade layout file.

@personalisedData

Registering data

Data to be returned from the personalised data module can be defined by attaching a callable with a key and return data to the attach function of the Creode\PersonalisedData\Services\PersonalisedData service class.

use Creode\PersonalisedData\Services\PersonalisedData;

PersonalisedData::attach('product_comparisons', function() {
    $productIds = app(StorageInterface::class)->get();
    return ProductRepository::with(['featuredImage', 'category'])->find($productIds);
});

Hydrating data

The data attribute fires off a JavaScript window event, with a detail parameter containing all of the personalised data. Once loaded submodules can listen to and act upon to attach the data to the page.

document.addEventListener('getPersonalisedDataComplete', (e) => {
    for (let product of e.detail.product_comparisons) {
        store.add(product);
    }
});

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-09-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固