Download the PHP package alanablett/twig-faker without Composer

On this page you can find all versions of the php package alanablett/twig-faker. 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 twig-faker

Build Status Code Coverage Scrutinizer Code Quality

Latest Stable Version Total Downloads Latest Unstable Version License

TwigFaker

An extension to add the faker library into twig templates, providing a fast efficient way to create dummy data within your templates. Here's a quick example:

Configure your fake data type factories/person.php

Use in your templates

Usage

Step 1: Install

Pull this package in through Composer.

Step 2: Register the TwigFaker extension with twig

Step 3: Create a Factories File

TwigFaker isn't magic. You need to describe the type of data that should be generated.

Each factory file you create will automatically have access to a $faker variable. This is just a normal factory that you would create by doing Faker\Factory::create.

Within a factories directory in the root of your project, you may create any number of PHP files that will automatically be loaded by TwigFaker. Why don't you start with a generic factories/person.php file.

Step 4: Call your new factory in a twig template

With your new factory defined, you can now use it in your twig template.

The first parameter passed to the fake method is the factory name to be used. The second parameter is the number of fake instances you want to loop through (default is 1 if no parameter is passed).

Note: You can organise your factories in folders such as factories/subfolder/another/example.php

Usage With Sculpin

Step 1: Install

Pull this package in through Composer by adding it to the sculpin.json file.

Step 2: Register the TwigFaker extension with sculpin

To use the extension in sculpin we have to add it to the extensions that sculpin knows about. This is done by adding it to app/config/sculpin_kernel.yml

Follow the further steps above to create new factories and use them in your templates.

Other Features

Caching

As of version 1.1 you can now cache your fake data in order to use later on down the page. This can be particularly useful when your markup must exist in different areas, but must use the same data. For example I have a hero block factory defined as follows

Now in my markup I would like to use the same data for two different calls to the fake method, so I simply pass in a key as the third argument to ensure the data is the same, in this case main-heroes


All versions of twig-faker with dependencies

PHP Build Version
Package Version
Requires twig/twig Version ~1.0
fzaninotto/faker Version ~1.5
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 alanablett/twig-faker contains the following files

Loading the files please wait ....