定制 gavinggordon/wordstore 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

gavinggordon/wordstore

Composer 安装命令:

composer require gavinggordon/wordstore

包简介

This is a CRUD compliant, language data storage class.

README 文档

README

Build Status

Synopsis

This PHP class ( GGG\WordStore ) is a CRUD compliant language data storage class. It provides the ability to create a language dictionary. All enteries you create are stored in the WordStore and can contain user-definited parameters, all of which can be: searched and retrieved; updated; and, deleted.

How to use 'WordStore'

Install via Composer...

	composer require gavinggordon/wordstore

Include autoload.php...

	include_once( __DIR__ . '/vendor/autoload.php' );

Create new instance...

	//
	// new WordStore( 
	// 
	// @param string $dictionary_file *optional* 
	// default value = 'dictionary.json'
	//  
	// );
	//
	// @return object
	// 
	
	$json_dictionary_file = __DIR__ . '/myDictionary.json';
	// optionally, override the default name to be used for the .json
	// dictionary file, where all the related word data will be stored
	
	$wordstore = new GGG\WordStore( $json_dictionary_file );
	// creates the dictionary storage file, if it doesn't already exist

Adding a word...

	//
	// WordStore->add(
	//
	//	@param string $part_of_speech *required*
	// possible values =	
	// 'adjective' || 'adverb' || 'article' || 'interjection' ||
	// 'noun' || 'pronoun' || 'personalpronoun' || 
	// 'preposition' || 'punctuation' || 'verb'
	//
	//	@param string $word *required*
	//	possible values = *
	//
	//	@param array $params *required*
	//	possible values = *
	//
	// );
	//
	// @return object | FALSE
	//
	
	$wordstore->add( 'noun', 'vuča', [ 
		'translation' => 'friend',
		'pronounciation' => 'voo-cha' 
	] );

Finding a word...

	//
	// WordStore->find(
	//
	//	@param string $value *required*
	//	possible values = *
	//
	//	@param string $part_of_speech *optional*
	// default value = NULL
	// possible values =	
	// 'adjective' || 'adverb' || 'article' || 'interjection' ||
	// 'noun' || 'pronoun' || 'personalpronoun' || 
	// 'preposition' || 'punctuation' || 'verb'
	//
	//	@param string $param *optional*
	// default value = NULL
	//	possible values = *
	//
	// );
	//
	// @return array | FALSE;
	//
	
	$word = $wordstore->find( 'vuča' );
	print_r( $word );
	 
	//
	// Array
	// (
	// 		[translation] => friend
	//		[pronounciation] => voo-cha
	// );
	//

Updating a word...

	//
	// WordStore->update(
	//
	//	@param string $newvalue *required*
	//	possible values = *
	//
	//	@param string $oldvalue *required*
	//	possible values = *
	//
	//	@param string $part_of_speech *optional*
	// default value = NULL
	// possible values = 
	// 'adjective' || 'adverb' || 'article' || 'interjection' ||
	// 'noun' || 'pronoun' || 'personalpronoun' || 
	// 'preposition' || 'punctuation' || 'verb'
	//
	//	@param string $param *optional*
	// default value = NULL
	//	possible values = *
	//
	// );
	//
	// @return object | FALSE
	//
	
	$wordstore->update( 'partner', 'vuča', 'noun', 'translation' );
	$word = $wordstore->find( 'buddy' );
	 
	//
	// Array
	// (
	//	  [0] => stdClass Object
	//	       (
	//              [translation] => partner
	//              [pronounciation] => voo-cha
	//        )
	// );
	//

Deleting a word...

	//
	// WordStore->delete(
	//
	//	@param string $newvalue *required*
	//	possible values = *
	//
	//	@param string $part_of_speech *optional*
	// default value = NULL
	// possible values = 
	// 'adjective' || 'adverb' || 'article' || 'interjection' ||
	// 'noun' || 'pronoun' || 'personalpronoun' || 
	// 'preposition' || 'punctuation' || 'verb'
	//
	// );
	//
	// @return object | FALSE
	//
	
	$wordstore->delete( 'vuča', 'noun' );
	$word = $wordstore->find( 'vuča' );
	 
	//
	// FALSE
	//

More Information

PHP Innovation Award

This class has been nominated for a PHP Innovation Award, provided by PHPClasses.org. If you found this class to be at all interesting, helpful, particularly useful, or innovative in any way, please vote for it, to show your support for this or any other PHP classes accessible online via my GitHub profile or PHPClasses.org profile.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固