2017 © Pedro Peláez
 

library skeleton-application

Skeleton Application for ZF2

image

mfcc/skeleton-application

Skeleton Application for ZF2

  • Sunday, July 15, 2018
  • by Tlapi
  • Repository
  • 3 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1631 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

MFCC - ZendSkeletonApplication

Introduction

This is a simple, skeleton application using the ZF2 MVC layer and module systems., (*1)

This skeleton comes with:, (*2)

Project is [optionally] integrated with: * Phing * Bower (nmp required) * Gulp (nmp required), (*3)

Installation

The recommended way to get a working copy of this project is to clone the repository and use composer to install dependencies using the create-project command:, (*4)

curl -s https://getcomposer.org/installer | php --
php composer.phar create-project mfcc/skeleton-application path/to/install

Alternately, clone the repository and manually invoke composer using the shipped composer.phar:, (*5)

cd my/project/dir
git clone https://github.com/Tlapi/ZendSkeletonApplication.git
cd ZendSkeletonApplication
php composer.phar self-update
php -c php.ini composer.phar install

(The self-update directive is to ensure you have an up-to-date composer.phar available.), (*6)

Project Setup

Setup project configs

Set your db connection. Copy config/autoload/local.php.dist to config/autoload/local.php and provide username, password etc., (*7)

Set your social login integration if needed in config/autoload/scn-social-auth.global.php and config/autoload/scn-social-auth.local.php.dist, (*8)

Create entities

Create your Entities and Repositories. Example provided is in module/Application/src/Application/Entity/Article.php, (*9)

Create database

Run, (*10)

php vendor/bin/doctrine orm:schema-tool:update --force

to create your database., (*11)

Run faker to fake your entities data if you want, (*12)

php public/index.php faker

[optional] Set up Phing

Set your deployment options in build.xml and deploy with cli:, (*13)

php phing-latest.phar

or apply your hotfix with:, (*14)

php phing-latest.phar applyhotfix

[optional] Set up Bower

Install bower (if not installed), (*15)

npm install -g bower

Require your project dependencies, e.g.:, (*16)

bower install jquery

And update your package file to share with others, (*17)

bower init

[optional] Set up Gulp

Install gulp globally (if needed), (*18)

npm install --global gulp

Edit gulpfile.js to meet your needs (set publicDir variable) and run, (*19)

gulp

To run individual tasks, use gulp <task> <othertask>., (*20)

Default Gulp setup

Gulp comes with following packages: * gulp-jshint * gulp-sass * gulp-concat * gulp-uglify * gulp-rename * main-bower-files, (*21)

gulp command does following: * Gets all libraries installed and required by bower in bower.js, copies them to publicdir/js/libs and concatenates them to publicdir/dist/libs.js, publicdir/dist/libs.min.js * checks any JavaScript file in our publicdir/js directory and makes sure there are no errors in our code (excluding subfolders) * compiles any of our Sass files in our publicdir/scss directory into .css and saves the compiled .css file in our publicdir/css directory * concatenates all JavaScript files in our publicdir/js directory (excluding subfolders) and saves the ouput to publicdir/dist/scripts.js, publicdir/dist/scripts.min.js, (*22)

Gulp watch watches publicdir/js, publicdir/js/libs and publicdir/js/scss for any changes., (*23)

How to use faker

Edit FakerController.php and then just run php public/index.php faker, (*24)

Example content of FakerController.php:, (*25)

$generator = \Faker\Factory::create();
$populator = new \Faker\ORM\Doctrine\Populator($generator, $this->getEntityManager());
$populator->addEntity('SomeEntity', 1000);
$populator->addEntity('ZfcUser\Entity\User', 100, array(
  'username' => null
));
$insertedPKs = $populator->execute();

Find more details here, (*26)

The Versions