Download the PHP package yuanqing/fi without Composer

On this page you can find all versions of the php package yuanqing/fi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fi

Fi.php Packagist Version Build Status Coverage Status

Fi lets you query a collection of text files, as if the folder of files were a database (well, almost).

Fi (rhymes with pie) is designed to be used as part of a static site generator.

Super quick start

There is a documented, runnable example you can play with:

There are also tests.

Quick start

Suppose we have organised our text files into neat date-based folders like so:

Each text file contains YAML frontmatter and content. The file 01-foo.md might be something like:

We would query our data directory like so:

Every file that matches the given $filePathFormat is a Document. A Collection, then, is simply an Iterator over a set of Documents:

We can also access a Document directly by index:

Map, filter, sort

Fi also supports map, filter, and sort operations over our Collection of Documents:

Default values

A text file will inherit default values (for fields or content) from any _defaults.md file found in the same directory, or in a parent directory. Defaults are said to cascade; _defaults.md files found further down the file hierarchy will overwrite those higher up the hierarchy.

API

Fi

Fi::query ( string $dataDir, string $filePathFormat [, string $defaultsFileName = '_defaults.md' ] )

Makes a Collection object.

Collection

map ( callable $callback )

Applies the $callback to each Document in the Collection. Returns the Collection object.

filter ( callable $callback )

Filter out Documents in the Collection using the $callback. Returns the Collection object.

sort ( callable $callback )

Sorts the Collection using the $callback. Returns the Collection object.

sort ( mixed $fieldName [, int $sortOrder = Fi::ASC ] )

Sorts the Collection by the $fieldName in the specified $sortOrder. Returns the Collection object.

toArr ( )

Gets all the Documents in the Collection as an array.

-

Document

getFilePath ( )

Gets the file path of the text file (relative to the $dataDir) that corresponds to the Document.

getFields ( )

Gets all the fields of the Document.

hasField ( mixed $fieldName )

Checks if the Document has a field with the specified $fieldName.

getField ( mixed $fieldName )

Gets the value of the specified $fieldName.

setField ( mixed $fieldName, mixed $fieldValue )

Sets the field with $fieldName to the specified $fieldValue. Returns the Document object.

hasContent ( )

Checks if the Document content is non-empty.

getContent ( )

Gets the Document content.

setContent ( string $content )

Sets the Document content to the specified $content. Returns the Document object.

-

Requirements

Fi requires at least PHP 5.3 or HHVM, and Composer.

Installation

  1. Install Composer.

  2. Install the Composer package:

  3. In your PHP file, require the Composer autoloader:

Testing

You need PHPUnit to run the tests:

License

MIT license


All versions of fi with dependencies

PHP Build Version
Package Version
Requires symfony/yaml Version ~2.5
yuanqing/extract Version ~0.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yuanqing/fi contains the following files

Loading the files please wait ....