All Projects → kapitchi → project-template-zf2-angularjs

kapitchi / project-template-zf2-angularjs

Licence: MIT license
Project template for ZF2 Apigility API and AngularJS application

Programming Languages

ruby
36898 projects - #4 most used programming language
Puppet
460 projects
shell
77523 projects
perl
6916 projects
CSS
56736 projects
PHP
23972 projects - #3 most used programming language

ZF2 Apigility and AngularJS project template

All-in-one development vagrant box and project scaffold for ZF2 Apigility API server and AngularJS client-side applications.

You do NOT have to install anything locally on your dev machine - vagrant box should provide all tools necessary!

Note: There are some known improvements to make and issues to fix. Please see TODO or github issues list.

What's included

Server-side related stuff

ZF2, Apigility, PHPUnit

Client-side related stuff

jQuery, AngularJS, UI Bootstrap, RequireJS, Karma/Jasmine, SASS, Bootstrap 3 SASS, FontCustom

Installation

Get a source code

Clone it:

git clone https://github.com/kapitchi/project-template-zf2-angularjs.git myapp

OR

Download it: https://github.com/kapitchi/project-template-zf2-angularjs/archive/master.zip

Vagrant up!

Note: Vagrant >=1.6 is required.

cd myapp
vagrant up

Build and run

Connect to a box

vagrant ssh

Build a project

./bin/init-build

After build runs successfully you should be able to see working app on: http://localhost:9002/

See other available services/links in Bookmarks section.

Bookmarks

Your project

http://localhost:9002/

You should be able to access your app from your local network also - just replace 'localhost' with your local IP address.
E.g. if your local network IP address is 192.168.1.123 the following should work: http://192.168.1.123:9002/

Apigility

http://192.168.56.101:9003/apigility/ui

Note: Available only in development mode. See Development section below.

Fontcustom icons

http://localhost:9002/build/icon/icon-preview.html

Note: You might need to run fontcustom compile first

PHP code coverage

http://localhost:9001/report/test/php/coverage/

Note: You need to run phpunit first

JS code coverage

http://localhost:9001/report/test/js/coverage/

Note: You might need to run karma start first

MySQL

http://localhost:9001/adminer/
User: root
Pass: 123

MySQL clients using TCP/IP over SSH

For tools like e.g. MySQL Workbench

SSH Hostname: localhost:2222 SSH Username: vagrant
SSH Key file: puphpet/files/dot/ssh/id_rsa
MySQL Hostname: 127.0.0.1
MySQL Port: 3306
MySQL user: root
MySQL pass: 123

Mailcatcher

http://192.168.56.101:1080/

In order to use mailcatcher your application mailer needs to be set up using this SMTP settings:
Host: 127.0.0.1
Port: 1025

Development

Note: Commands below supposed to be run on vagant box (in /vagrant folder) and not locally on you development machine.

Apigility Admin

Apigility Admin is devel tool and needs write permission on certain folders/files (e.g. config/autoload/global.php, config/autoload/local.php, module folder, etc). Instead of messing up with write permissions on project folders it's better to run it using PHP build-in server using vagrant user.

On vagrant box run a script below. This enables development mode, then runs Apigility using PHP build-in server and once stopped (using CTRL+C) switches development mode off again.

./bin/apigility

Apigility admin should be now available - see Bookmarks section for URL.

SASS/CSS

Source folder: asset/sass
Build command: compass compile
Build path: public/build/css

Fontcustom icon folder: asset/icon
Build command: fontcustom compile
Build path: public/build/icon

Fontcustom scss is not imported by default - go to asset/sass/global.scss to include it.

Unit testing

PHP

Tests are under test/php folder.

phpunit

Code coverage http://localhost:9001/report/test/php/coverage/

Javascript

Tests are under test/js folder.

karma start

Code coverage http://localhost:9001/report/test/js/coverage/

Grunt tasks

grunt bower - adds bower components into RequireJS config file public\config.js

PHP Debugging

Find an extension for your browser here: http://xdebug.org/docs/remote

Start listening to debug connections in your IDE, switch debug on using browser extension and refresh the page (tested with PhpStorm 7.1.3). Note: You need to set path mapping in your IDE: your local project root folder = /vagrant path on vagrant box

Vagrant box

Ubuntu Trusty 14.04 LTS x64

Box is based on https://puphpet.com/ with some extra provisioning (puphpet/files/exec-once).

Default configuration can be modified in /puphpet/config.yaml. This file can be uploaded to https://puphpet.com/ to be modified using an UI.

  • Apache
  • PHP 5.5 - xdebug
  • MySQL
  • mailcatcher

See DEVELOP.md for modified files/folders generated by puphpet.com.

TODO

See: https://github.com/kapitchi/project-template-zf2-angularjs/issues

  • grunt-ify project
  • replace provisioning shell scripts with puppet stuff
  • Advanced Rest Client example settings
  • docs generation
  • apigility server (grunt) command
  • set PHP to use mailcatcher

To consider

Contributing

Please contact me on [email protected] with any comments/feedback/ideas.

License

The MIT License (MIT)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].