ptlis/php-serialized-data-editor 问题修复 & 功能扩展

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

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

ptlis/php-serialized-data-editor

Composer 安装命令:

composer require ptlis/php-serialized-data-editor

包简介

Manipulate PHP-serialized data without deserialization

README 文档

README

Tools for manipulating PHP serialized datastructures without deserializing and re-serializing the data.

This is useful when:

  • You don't or can't have the classe definitions loaded (e.g. when processing arbitrary data in a DB, Redis etc).
  • You don't want to invoke the __wakeup method (e.g. it tries to connect to a resource not available in the execution context).

Build Status Code Coverage Scrutinizer Code Quality License Latest Stable Version

Install

With composer:

$ composer require ptlis/php-serialized-data-editor

Usage

This library currently supports basic search & replacement of string values (ignoring array keys and property names):

use ptlis\SerializedDataEditor\Editor;

// Mock some serialized data
$serialized = serialize([
    'test' => 'foo',
    'test2' => 'foobar foo',
    'foo' => 'baz'
]);

$editor = new Editor();

// Count how many times the search term exists as a string value
$containsCount = $editor->containsCount($serialized, 'foo');  // $containsCount === 3

// Replace all instances of the search term with the replacement term
$modified = $editor->replace($serialized, 'foo', 'wibble');
/**
 * $modified when unserialized is:
 * [
 *     'test' => 'wibble',
 *     'test2' => 'wibblebar wibble',
 *     'foo' => 'baz'
 * ]
 */

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固