codeenigma/jsonpopulate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

codeenigma/jsonpopulate

Composer 安装命令:

composer create-project codeenigma/jsonpopulate

包简介

A PHP tool to populate JSON data from existing web pages.

README 文档

README

Build Status

jsonPopulate

A PHP tool to populate JSON data from existing web pages. This allow the use of relevant content instead of "dummy" one for HTML prototypes (PatternLab and similar)

JsonPopulate screencast

Requirements

jsonPopulate requires php 7.0 or greater.

Install

Clone and install dependencies with composer, by running:

composer install

Alternatively, you can integrate it to your own project:

composer require --dev codeenigma/jsonpopulate

Setup

Server

Simplest is to use php built in server:

cd www && php -S localhost:8000

or, if inside a VM of some kind, use the appropriate IP, eg for ce-vm:

cd /vagrant/www && php -S 192.168.56.4:8000

If in doubt or having issues, you can use the 0.0.0.0 IP to listen on all addresses. This means it potentially is accessible by others on the same network, so can be a security issue.

cd /vagrant/www && php -S 0.0.0.0:8000

Configuration

Create a jsonpopulate.yml file somewhere in a parent folder of the jsonpopulate codebase. Look at the example folder for how the syntax look like, it basically consists in pairing "source" json files with "url" targets.

Note 1: The config file can be directly within any parent directory of the main jsonpopulate codebase

Eg, provided jsonpopulate is at

~/Projects/examples/prototype/tools/jsonpopulate

Your config file can be at any of these locations:

~/Projects/examples/prototype/tools/jsonpopulate.yml

~/Projects/examples/prototype/jsonpopulate.yml

~/Projects/examples/jsonpopulate.yml

~/Projects/jsonpopulate.yml

...

but can NOT be at eg:

~/Projects/examples/prototype/config/jsonpopulate.yml

Note 2: Paths to the sources files are relative to the config file

Using the same example as above, given a config file at

~/Projects/examples/prototype/jsonpopulate.yml

and a json file at

~/Projects/examples/prototype/pattern-lab/source/data.json

the "source" for that file in your jsonpopulate would be "pattern-lab/source/data.json"

Usage

Loading

Visit http://localhost:8000. You should be presented with:

  • a list of available pages at the top
  • a dual pane window with:
    • the JSON values as text field on the left
    • the matching URL loaded as a fake iframe on the right

Setting values

Start by clicking on a supported element (links, images, ...) on the visited url on the right. Then click on the json value you want to fill/override: you should be presented with a dropdown of possible variants derived from the previously clicked element.

Navigating

To make it easier to find the elements you want, the "iframe" also allows you to navigate further between inner pages. To bypass the click hijack and actually follow a link, hold the "Alt" key while you click.

Known issues

  • Due to cross-domain/CORS restrictions, iframe "escaping" scripts, bot detections measures and so on, the rendering of the the source url may vary greatly. Some domains (typically behind Sucuri or similar) will enterly fail to load, some will only miss a few fonts, while others will be mildly affected by partial execution of some Javascript parts.
  • Only a few elements (a, img, p, span, submit) are currently supported.

Security

Should be obvious, but this is intended for local dev usage. Never make this accessible over http on a public server. NEVER !

codeenigma/jsonpopulate 适用场景与选型建议

codeenigma/jsonpopulate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 703 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 codeenigma/jsonpopulate 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2018-02-23