gavinggordon/wordstore 问题修复 & 功能扩展

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

邮箱: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
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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