Posts Tagged ‘php class’

PHP Spell Checker v1.1

February 16th, 2010

A new version of PHP Spell Checker is available.
The new feature is checking the spelling with Google’s “Did you mean” feature, so not a big update, but useful non the less.

The syntax is the same:

<?php

// include the class
require_once(dirname(__FILE__)."/../GDYMSpellChecker.class.php");

// instantiate the class
$spellCheck = new GDYMSpellChecker();

$textWithErrors = "PHP: the quik browm fox jumps over the lazi dog lazi today"; // this text has 3 errors
$result = $spellCheck->checkSpelling($textWithErrors, "en-US"); // will return an array with the wrong words with associated suggestions
//$result = $spellCheck->checkSpelling($textWithErrors, "en-US", false); // will return an array with the wrong words without associated suggestions
//print_r($spellCheck->getWarnings());// get all warnings
//print_r($spellCheck->getErrors());// get all errors
if (count($result) == 0) {
	print "Text is OK !<br/>";
} else {
	print "Text has errors !<br/>";
	print "<pre>";
	print_r($result);
}

?>

For further reading about the PHP class [p2p type=”id” value=”20″ text=”read this post”].

Download the class from here

VN:F [1.9.22_1171]
Rating: 7.7/10 (15 votes cast)

Simple XML Parser Namespace support

October 27th, 2009

I have added support for namespaces to the parser.
What this means, you are now able to register a namspace in order to be able to parse the XML.

Also the usage of this class changed.

<?php

$xml = "http://www.protung.ro/feed/atom/"; // parse an Atom feed

// create a new object
$parser = new SimpleLargeXMLParser();
// load the XML
$parser->loadXML($xml);

// register the namespace
$parser->registerNamespace("atom", "http://www.w3.org/2005/Atom");
// this will get an array of entries
$array = $parser->parseXML("//atom:feed/atom:entry");

?>

As always, you can download the new version from here.

VN:F [1.9.22_1171]
Rating: 8.5/10 (14 votes cast)

New PHP Simple Large XML Parser version

October 2nd, 2009

I have added support for node attributes to the PHP Simple Large XML Parser class.

Now it’s possible to retrieve the structure of the XML document with the attributes of the nodes. If you choose to get the nodes also the structure of the result array will be different from the non-attribute array.

The new structure will be like this:

<?php

array('value'=> 'another node / value' ,
     'attributes'=>array('attribute name'=>'attribute value',
                    'another attribute'=>'some value',
                    'yet another attribute'=>'other value'
                    )
);

?>

In order to get the array with attributes you need to pass the 3rd parameter as true:

<?php

   SimpleLargeXMLParser::parseXML($xml, "//myFirstNode", true);

?>

You can download the new version from here.

Please [p2p type=”id” value=”180″ text=”read this post”] for more information about the functionality of the class:

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)

PHP Yahoo Messenger Archive Decoder v1.5

September 10th, 2009

A new version of PHP Yahoo Messenger Archive Decoder is available for download.

I know 2 years have passed since the release (or actually any other modifications), but a friend asked me to modify it so he can use it to parse conference history files. So this is what’s new in this version.

I really don’t think a new version will be added, unless it will not work anymore with the latest yahoo messenger version (it still works with version 10 beta)

VN:F [1.9.22_1171]
Rating: 8.4/10 (8 votes cast)

PHP simple large XML parser

September 6th, 2009

I needed a simple PHP script to parse large XML files fast and without huge memory consumption, so I’ve written a small class for this.

This class can be used to parse large XML files (it works with small one also) fast and with minimum of memory consumption.
It can parse any valid XML and convert it to an array. What it does not do is to get the attributes of the nodes.
If you need it, contact me and i can implement it for you if you want.

You can parse any part of the XML as it supports XPath with the same performance as parsing the entire XML (well, a little bit faster as it’s less data to parse)

» Read more: PHP simple large XML parser

VN:F [1.9.22_1171]
Rating: 10.0/10 (3 votes cast)

PHP WSDL Generator new version work in progress

September 1st, 2009

i started working on a new (improved) version of PHP WSDL Generator.
Many people have asked for new features and better output this is what the new version will have.
I will also rewrite almost all the code.

The new PHP parser is almost done. Now you can also add classes without specifying files. Just include them in your code and tell the generator to also use those classes. Of course the old way to add classes (by specifying files with PHP code) will still be available, but unlike before when the content of the files was parsed, now the files first will be included (using require_once() ). I know this is not ideal if you have other code that must not arbitrary execute, but then again it’s good practice to have the classes separated from any other code. The new parser will be much faster and more accurate.

That’s all for now, I will post more news about this after more work is done.

Please don’t ask when the release will happen as I don’t know. I do this in my free time witch is somehow limited right now.

VN:F [1.9.22_1171]
Rating: 8.3/10 (35 votes cast)

PHP Spell Checker

August 18th, 2009

This package can be used to check the spelling of text and get fix suggestions.

There is a base class that defines functions for spell checking.

There are also two classes for checking the spelling of text using either PHP scripts that contain arrays of valid words and grammar definitions, or using the hunspell program.

If the classes determine that there are misspelled words, they may return suggestions for eventual fixes.

» Read more: PHP Spell Checker

VN:F [1.9.22_1171]
Rating: 9.7/10 (12 votes cast)

PHP WSDL Generator

August 18th, 2009

This package can be used to generate a Web Services Definition Language (WSDL) document from the code of a class that implements Web services calls.

It parses the code of a given PHP class script files and generates a WSDL definition from the list of the class functions.

Certain functions may be skipped to not be included in the WSDL definition based on the function access type.

The generated WSDL may be saved to a given file, returned as a string or served for download.

Download class

VN:F [1.9.22_1171]
Rating: 9.4/10 (9 votes cast)

Timed One Time Password (TOTP)

August 17th, 2009

This class can be used to generate and validate one time passwords that may expire after a period of time (without using a database or saving the password of any kind).

It generates a code based on a secret key that is valid during a period of time.

The class can also be used to validate the generated code in a different server and check if the code expired.

Download class

» Read more: Timed One Time Password (TOTP)

VN:F [1.9.22_1171]
Rating: 8.0/10 (1 vote cast)

PHP Yahoo Messenger Archive Decoder

August 17th, 2009

This class can be used to parse and extract information from Yahoo Messenger chat history files.

It can parse a given chat history file and extract several details of each message that was exchanged in the chat sessions.

The class retrieves the message text and length, timestamp and the identifier of the user that sent the message.

The message text is retrieved in HTML format, but the class may strip HTML formatting.

Download class

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)