承接 fakerino/nette-fakerino 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fakerino/nette-fakerino

最新稳定版本:0.0.2

Composer 安装命令:

composer require fakerino/nette-fakerino

包简介

Nette extension for Fakerino

README 文档

README

Latest Stable Version License

Provides an easy way to include Fakerino in Nette framework as a service.

More information in the official documentation.

Installation

Add the following dependencies to your projects composer.json file:

    "require": {
        "fakerino/nette-fakerino": "0.0.*",
    }

Install the Open Data Sample in two ways:

  • Add a script to your composer.json:
  "scripts": {
        "post-install-cmd": "vendor/fakerino/fakerino/build/ods vendor/fakerino/fakerino/data",
        "post-update-cmd": "vendor/fakerino/fakerino/build/ods vendor/fakerino/fakerino/data"
    }

In this way the data will be always updated automatically via composer.

  • Run maually the command (after the fakerino composer installation): $ vendor/fakerino/fakerino/build/ods vendor/fakerino/fakerino/data

Configuration

Add in your config.neon the service definition as below:

services:
	fakerino:
	    class: Fakerino\Core\FakeDataFactory
	    factory: Fakerino\FakerinoNette\FakerinoServiceFactory::create

In order to customise the Fakerino default configuration you could add fakerino in your config.neon parameters.

parameters:
    fakerino:
        locale: cs-CZ
        fake:
            fakeMale:
              - titlemale
              - nameMale
              - surname
            fakeFemale:
              - titlefemale
              - namefemale
              - surname
        database:
            dbname: mydb
            user: username
            password: password
            host: localhost
            driver: pdo_mysql

Presenter example

<?php

namespace App\Presenters;

use Nette,
	App\Model;
use Fakerino\Core\FakeDataFactory;

/**
 * Homepage presenter.
 */
class HomepagePresenter extends Nette\Application\UI\Presenter
{
    /**
     * @var \Fakerino\Core\FakeDataFactory
     */
    private $fakerino;

    public function __construct(FakeDataFactory $fakerino)
    {
        $this->fakerino = $fakerino;
    }

	public function renderDefault()
	{
		$this->template->surname = $this->fakerino->fake('surname');
	}
}

统计信息

  • 总下载量: 51
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-01