# # Fedora spec file for php-flow-jsonpath # # Copyright (c) 2017 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT # # Please preserve changelog entries # %global github_owner FlowCommunications %global github_name JSONPath %global github_version 0.3.4 %global github_commit 00aa9c361e4d0a210dd95f3c917a1e0dde3a957f %global composer_vendor flow %global composer_project jsonpath # "php": ">=5.4.0" %global php_min_ver 5.4.0 # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} %{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} Release: 1%{?github_release}%{?dist} Summary: JSONPath implementation for parsing, searching and flattening arrays Group: Development/Libraries License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz # Add LICENSE file # https://github.com/FlowCommunications/JSONPath/pull/20 Patch0: %{name}-add-license-file.patch BuildArch: noarch # Tests %if %{with_tests} ## composer.json BuildRequires: php(language) >= %{php_min_ver} BuildRequires: php-composer(phpunit/phpunit) ## phpcompatinfo (computed from version 0.3.4) BuildRequires: php-json BuildRequires: php-pcre BuildRequires: php-spl ## Autoloader BuildRequires: php-composer(fedora/autoloader) %endif # composer.json Requires: php(language) >= %{php_min_ver} # phpcompatinfo (computed from version 0.3.4) Requires: php-json Requires: php-pcre Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description This is a JSONPath [1] implementation for PHP based on Stefan Goessner's JSONPath script. JSONPath is an XPath-like expression language for filtering, flattening and extracting data. I believe that is improves on the original script (which was last updated in 2007) by doing a few things: * Object-oriented code (should be easier to manage or extend in future) * Expressions are parsed into tokens using some code cribbed from Doctrine Lexer and cached * There is no eval() in use * Performance is pretty much the same * Any combination of objects/arrays/ArrayAccess-objects can be used as the data input which is great if you're de-serializing JSON in to objects or if you want to process your own data structures. Autoloader: %{phpdir}/Flow/JSONPath/autoload.php [1] http://goessner.net/articles/JsonPath/ %prep %setup -qn %{github_name}-%{github_commit} : Add LICENSE file %patch0 -p1 %build : Create autoloader cat <<'AUTOLOAD' | tee src/Flow/JSONPath/autoload.php - 0.3.4-1 - Initial package