npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-symfonangular

v2.4.2

Published

PHP Symfony 3 framework with Javascript AngularJS framework integration for full stack development.

Downloads

59

Readme

generator-symfonangular

npm version Build Status Code Climate Dependency Status Installs License Join the chat at https://gitter.im/zguillez/generator-symfonangular

Zguillez | Guillermo de la Iglesia

Yeoman generator for full stack development with (PHP) Symfony and (Javascript) AngularJS application

Getting Started

Install Yeoman

npm install -g yo

Yeoman Generators

To install generator-symfonangular from npm, run:

npm install -g generator-symfonangular

//or:
sudo npm install -g generator-symfonangular

Finally, initiate the generator:

yo symfonangular

If you have error on install try to update dependences manually:

sudo npm update
bower update --allow-root

Install Symfony vendors with Composer

After generator install, you will need install Symfony vendor running this command:

./composer.phar self-update && ./composer.phar install

Requeriments

NodeJS

For update npm

sudo npm install npm -g

Bower

npm install -g bower

Sass

sudo gem install sass

Usage

Symfony routing on file /src/AppBundle/Resources/config/routing.yml:

_home:
    path:     /
    defaults: { _controller: AppBundle:Defaults:index }

AngularJS routing on file /src/AppBundle/Resources/js/init.js:

$routeProvider.when('/home/a', {
    templateUrl: 'modules/slideA.html',
    controller: 'homeSlideAController'
  }).when('/home/b', {
    templateUrl: 'modules/slideB.html',
    controller: 'homeSlideBController'
  }).when('/home/intro', {
    templateUrl: 'templates/intro.html',
    controller: 'introController'
  }).otherwise({
    redirectTo: '/home/a'
  });

AngularJS controllers

Place on folder: /src/AppBundle/Resources/js/

CSS styles

Place on folder: /src/AppBundle/Resources/css/ with .sass or .scss format

Conpiled files

Grunt serve and build will compile .sass and .scss files into css files on folder: /src/AppBundle/Resources/public/css

And Javascript files will miminized into folder: /src/AppBundle/Resources/public/js

Symfony will include this files into template by Assetic mode:

{% block stylesheets %}
  <link rel="stylesheet" href="{{ asset('lib/css/normalize.css') }}"/>
  <link rel="stylesheet" href="{{ asset('lib/css/animate.min.css') }}"/>
  <link rel="stylesheet" href="{{ asset('lib/css/bootstrap.min.css') }}"/>
  {% stylesheets
  '@AppBundle/Resources/public/css/*.css' filter='cssrewrite' %}
  <link rel="stylesheet" href="{{ asset_url }}"/>
  {% endstylesheets %}
{% endblock %}

{% block javascripts %}
  <script src="{{ asset('lib/scripts/require.js') }}"></script>
  <script src="{{ asset('lib/scripts/jquery.min.js') }}"></script>
  <script src="{{ asset('lib/scripts/angular.min.js') }}"></script>
  <script src="{{ asset('lib/scripts/angular-route.min.js') }}"></script>
  <script src="{{ asset('lib/scripts/bootstrap.min.js') }}"></script>
  <script src="{{ asset('lib/scripts/html5shiv.min.js') }}"></script>
  {% javascripts
  '@AppBundle/Resources/public/js/*.js' %}
  <script src="{{ asset_url }}"></script>
  {% endjavascripts %}
{% endblock %}

You can also add stylesheeds and scripts from Symfony asset folder /web.

Grunt task Copy.js will copy files from /bower_components folder to /web/lib/css/ or /web/lib/scripts/ folders. You can edit this task as you need.

Working with templates

For set data from Symfony controller to AngularJS template, you need to insert AngularJS template inside Symfony template:

<div id="container" class="container">
    {% include 'AppBundle::Page/modules/slideA.html.twig' %}
    {% include 'AppBundle::Page/modules/slideB.html.twig' %}
    <div class="row">
      <div class="col-xs-12">
        <div ng-view></div>
      </div>
    </div>
  </div>

Angualar template is like this:

<script type="text/ng-template" id="modules/slideA.html">
  <div class="panel panel-default">
    <div class="panel-body">
      <h2>{{ title }}</h2>
      <h3>[[ subtitle ]]</h3>
      <a class="btn btn-default" ng-click="gotoView('home/b')">CHANGE SUBVIEW</a>
    </div>
  </div>
</script>

Then you can bind data fron Symfony {{ title }} or from Angular [[ subtitle ]]

You can define AngularJS tag symbols on file init.js

$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');

Usage on Symfony controller:

return $this->render('AppBundle:Page:home.html.twig', array(
      'title' => 'Title from Symfony'
    ));

Usage on Angular controller:

app.controller('homeSlideAController', ['$scope', function ($scope) {
  $scope.subtitle = "Subtitle SlideA from Angular";
}]);

Working with AngularJS external templates

For transfer data from Symfony to external AngularJS template you need to set the data to a javascript variable on Symfony template:

<script>var title="{{ title }}";</script>

And read it on AngularJS template:

app.controller('introController', ['$scope', function ($scope) {
  $scope.title = title;
  $scope.subtitle = "Text from Symfony to Angular";
  $scope.text = "intro";
}]);

So we can only bind AngularJS data:

<div class="panel panel-default">
	<div class="panel-body">
    <h2>[[ title ]]</h2>
    <h3>[[ subtitle ]]</h3>
    <p>[[ text ]]</p>
		<a class="btn btn-default" ng-click="gotoView('home/a')">HOME</a>
	</div>
</div>

Runnig and Testing

You can run a local server for development on port http://localhost:8000/

grunt serve

Run server on production mode

grunt serve:prod

Build release

grunt build

Grunt taks

You can edit Grunt.js file por edit grunt task, on folder /grunt as you need.

Contributing and issues

Contributors are welcome, please fork and send pull requests! If you have any ideas on how to make this project better then please submit an issue or send me an email.

License

©2016 Zguillez.io

Original code licensed under MIT Open Source projects used within this project retain their original licenses.

Changelog

v2.4.0 (August 22, 2016)

Update Node and Bower dependencies.

v2.2.0 (January 29, 2016)

Remove Symfony vendors auto install.

Fixes:

  • Composer autoload error on install generator.

v2.1.0 (January 11, 2016)

Fixes:

  • Production enviorement deploy

v2.0.0 (January 9, 2016)

Update Symfony to 3.0.1

v1.0.0 (June 9, 2015)

Initial Symfony2 Framework skeleton with AngularJS

Features:

  • implements Symfony 2
  • implements AngularJS

Analytics