rpms/php-json/FC-4 php-json.html, NONE, 1.1 php-json.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
Ignacio Vazquez-Abrams (ivazquez)
fedora-extras-commits at redhat.com
Sat Dec 31 11:32:08 UTC 2005
Author: ivazquez
Update of /cvs/extras/rpms/php-json/FC-4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2278/FC-4
Modified Files:
.cvsignore sources
Added Files:
php-json.html php-json.spec
Log Message:
auto-import php-json-1.1.0-1.fc4 on branch FC-4 from php-json-1.1.0-1.fc4.src.rpm
--- NEW FILE php-json.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>omar kilani - projects - php-json</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="/aurore.css" type="text/css" />
</head>
<body>
<div class="centered">
<br /><br />
<table border="0" cellspacing="0" cellpadding="0" width="720">
<tr>
<td valign="top" rowspan="2"> </td>
<td>
<a href="/"><img src="/images/omar_kilani.gif" width="155" height="24" alt="omar kilani" /></a><br /><br />
<a href="/">home</a> | <a href="/projects/">projects</a><br />
<p><a href="/projects/libical/">libical</a> | <a href="/projects/php-js/">php-js</a> | <b>php-json</b> | <a href="/projects/postfix_memcached/">postfix_memcached</a></p>
<br />
</td>
<td valign="top" rowspan="2"> </td>
</tr>
<tr>
<td valign="top" class="full_width">
<!-- START CONTENT -->
<h1>php-json</h1>
<p><b>php-json</b> is an extremely fast PHP C extension for <a href="http://www.json.org/">JSON</a> (JavaScript Object Notation) serialisation. <b>php-json</b> uses a forked version of <a href="http://oss.metaparadigm.com/json-c/">json-c</a>.</p>
<h2>Download</h2>
<p>Version <a href="/projects/php-json/php-json-ext-1.1.0.tar.bz2">1.1.0</a> (<a href="/projects/php-json/php-json-4.3.2_1.1.0-1.aurore.src.rpm">SRPM</a>, <b>Win32</b>: <a href="/projects/php-json/php_json-1.1.0_php-4.x.zip">PHP 4.x</a>, <a href="/projects/php-json/php_json-1.1.0_php-5.0.x.zip">PHP 5.0.x</a>, <a href="/projects/php-json/php_json-1.1.0_php-5.1.x.zip">PHP 5.1.x</a>) - Released 2005-12-04 - Port to Win32.</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.8.tar.bz2">1.0.8</a> (<a href="/projects/php-json/php-json-4.3.2_1.0.8-1.aurore.src.rpm">SRPM</a>) - Released 2005-12-01 - Changed license to LGPL, modified build system to allow static compilation into PHP, added strndup check for json-c.</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.7.tar.bz2">1.0.7</a> - Released 2005-09-07 - Fixed issues with negative array keys (Thanks to <b>Marek Lewczuk</b> for the report,) modified json-c to return an error on unquoted object key names instead of going into an infinite loop.</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.6.tar.bz2">1.0.6</a> - Released 2005-08-05 - Fixed issues with exporting private and protected class members (Thanks to <b>Marek Lewczuk</b> for the report.)</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.5.tar.bz2">1.0.5</a> - Released 2005-06-16 - Changed spacing in json-c encoding, added optional <b>assoc (boolean)</b> parameter to json_decode to decode as associative array instead of object (Thanks to <b>James Jones</b> for the patch and <b>Oscar F. Durón</b> for the discussion), fixed issues with escaping /.</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.3.tar.bz2">1.0.3</a> - Released 2005-06-15 - Fixed json-c string corruption issues under Mac OS X (thanks to <b>Brett Stimmerman</b> for the report) and FreeBSD (thanks to <b>Robert S Wojciechowski</b> for the report.)</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.2.tar.bz2">1.0.2</a> - Released 2005-06-11 - Fixed issues with object reference counts under PHP4. Thanks to <b>James Jones</b> for the report.</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.1.tar.bz2">1.0.1</a> - Released 2005-06-10 - Fixed non-linear and mixed type array index issues, fixed issues with escaping \\, forked json-c and added Unicode support.</p>
<p>Version <a href="/projects/php-json/php-json-ext-1.0.0.tar.bz2">1.0.0</a> - Released 2005-04-01 - Initial release.</p>
<h2>Mailing List </h2>
<table style="border:1px solid #aa0033; font-size:small" align=center>
<tr>
<td rowspan=3>
<img src="http://groups-beta.google.com/groups/img/groups_medium.gif" height=58 width=150 alt="Google Groups">
</td>
<td colspan=2 align=center><b>Subscribe to php-json</b></td>
</tr>
<form action="http://groups-beta.google.com/group/php-json/boxsubscribe">
<tr>
<td>Email: <input type=text name=email></td>
<td>
<table
style="background-color:#ffcc33;padding:2px;border:2px outset #ffcc33;">
<tr>
<td>
<input type=submit name="sub" value="Subscribe">
</td>
</tr>
</table>
</td>
</tr>
</form>
<tr><td colspan=2 align=center>
<a href="http://groups.google.com/group/php-json">Browse Archives</a> at <a href="http://groups.google.com/">groups.google.com</a>
</td></tr>
</table>
<h2>Documentation</h2>
<p>A simple <b>./configure; make; make install</b> should do the trick. Make sure to add an <b>extension=json.so</b> line to your php.ini/php.d. <b>Note:</b> you need to compile php-json with gcc 3.x and up.</p>
<p>Then, just use <b>json_encode</b> to encode your PHP values into JSON, and <b>json_decode</b> to decode JSON into a PHP value.</p>
<p>For example:</p>
<pre>
$output = json_encode($val);
echo $output."\n";
</pre>
<p>Would produce:</p>
<pre>
{ "abc": 12, "foo": "bar", "bool0": false, "bool1": true, "arr": [ 1, 2, 3, null, 5 ], "float": 1.2345 }
</pre>
<p>While:</p>
<pre>
$input = '{ "abc": 12, "foo": "bar", "bool0": false, "bool1": true, "arr": [ 1, 2, 3, null, 5 ], "float": 1.2345 }';
$val = json_decode($input);
echo $val->abc."\n";
</pre>
<p>Would produce:</p>
<pre>
12
</pre>
<p>As of version <b>1.0.5</b>, <b>json_decode</b> takes an optional parameter, <b>assoc (boolean)</b>, that returns an associative array instead of an object.</p>
<p>A PHP object correlates to a JavaScript object (associative array, i.e., key => value pairs), so the above would be referenced in JavaScript like so:</p>
<pre>
var obj = ...; /* retrieve JSON and eval() it, returning an object */
var result = obj["abc"] * obj["float"];
alert("result is " + result);
</pre>
<p>This should display an alert box with the value of result, i.e., 14.814.</p>
<h2>Performance</h2>
<p>Following are some performance metrics for the php-json C extension in comparison to a native PHP implementation of JSON. The C extension is <b>86</b> times faster than the native PHP implementation in this test. More complex examples generally show the C extension in even better light, where a speed increase of <b>270</b> times is not uncommon.</p>
<pre>
Test string is:
{ "abc": 12, "foo": "bar", "bool0": false, "bool1": true, "arr": [ 1, 2, 3, null, 5 ], "float": 1.2345 }
Initial C output is:
object(stdClass)#1 (6) refcount(1){
["abc"]=>
long(12) refcount(1)
["foo"]=>
string(3) "bar" refcount(1)
["bool0"]=>
bool(false) refcount(1)
["bool1"]=>
bool(true) refcount(1)
["arr"]=>
array(5) refcount(1){
[0]=>
long(1) refcount(1)
[1]=>
long(2) refcount(1)
[2]=>
long(3) refcount(1)
[3]=>
NULL refcount(1)
[4]=>
long(5) refcount(1)
}
["float"]=>
double(1.2345) refcount(1)
}
Timing 1000 iterations with C
0.027885913848877 seconds elapsed
Initial PHP output is:
object(ObjectFromJSON)#3 (6) refcount(2){
["abc"]=>
long(12) refcount(1)
["foo"]=>
string(3) "bar" refcount(1)
["bool0"]=>
bool(false) refcount(1)
["bool1"]=>
bool(true) refcount(1)
["arr"]=>
array(5) refcount(1){
[0]=>
long(1) refcount(1)
[1]=>
long(2) refcount(1)
[2]=>
long(3) refcount(1)
[3]=>
NULL refcount(1)
[4]=>
long(5) refcount(1)
}
["float"]=>
double(1.2345) refcount(1)
}
Timing 1000 iterations with PHP
2.3223311901093 seconds elapsed
</pre>
<!-- END CONTENT -->
<br /><br />
</td>
</tr>
</table>
</div>
</body>
</html>
--- NEW FILE php-json.spec ---
%define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
%{!?php_version:%define php_version %(php-config --version 2>/dev/null || echo 4.3.11)}
Name: php-json
Version: 1.1.0
Release: 1%{?dist}
Summary: An extremely fast PHP extension for JSON
Group: Development/Languages
License: LGPL
URL: http://www.aurore.net/projects/php-json/
Source0: http://www.aurore.net/projects/php-json/php-json-ext-%{version}.tar.bz2
Source1: php-json.html
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: php-devel
Requires: php = %{php_version}
%description
php-json is an extremely fast PHP C extension for JSON (JavaScript Object
Notation) serialisation.
%prep
%setup -q -n php-json-ext-%{version}
install -p -m 0644 %{SOURCE1} .
phpize --clean
phpize
%build
%configure
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{php_extdir}
install -p -m 0755 modules/json.so $RPM_BUILD_ROOT%{php_extdir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/php.d
cat > $RPM_BUILD_ROOT%{_sysconfdir}/php.d/json.ini << EOF
; Enable json extension module
extension=json.so
EOF
%check ||:
cat > test.ini << EOF
open_basedir=
safe_mode=0
output_buffering=0
extension_dir=${PWD}/modules
extension=json.so
EOF
php -m -c test.ini 2> /dev/null | grep -q json || {
echo "JSON extension not loadable!"
exit 1
}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc php-json.html
%config(noreplace) %{_sysconfdir}/php.d/json.ini
%{php_extdir}/json.so
%changelog
* Fri Dec 30 2005 Ignacio Vazquez-Abrams <ivazquez at ivazquez.net> 1.1.0-1
- Initial RPM release
Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/php-json/FC-4/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 31 Dec 2005 11:31:10 -0000 1.1
+++ .cvsignore 31 Dec 2005 11:32:07 -0000 1.2
@@ -0,0 +1 @@
+php-json-ext-1.1.0.tar.bz2
Index: sources
===================================================================
RCS file: /cvs/extras/rpms/php-json/FC-4/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 31 Dec 2005 11:31:10 -0000 1.1
+++ sources 31 Dec 2005 11:32:07 -0000 1.2
@@ -0,0 +1 @@
+4a1a41fafabf866784868af59bf30510 php-json-ext-1.1.0.tar.bz2
More information about the fedora-extras-commits
mailing list