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-slimrest-angular

v0.0.4

Published

Yeoman generator to build AngularJS+Jade+SASS application with SlimPHP 3.0 RESTful backend

Downloads

6

Readme

generator-slimrest-angular

npm npm

Twitter Follow

Yeoman generator that scaffold AngularJS application with PHP Slimframework 3.0


Introduction

This generator scaffolds angularJS web application with PHP RESTful backend.

RESTful backend is implemented on top of PHP Slimframework 3.0, configured with PHPActiveRecord ORM to connect to database. JWT based authentication/authorization is presented as well.

Jader? I'm Jade/SASS guy as well

Frontend is backed with optional Jade and SASS support.

Another Generator ?!

I created this generator inspired by the awesome angular-fullstack generator, every module is boxed within one directory contains controllers, views, services, specs, etc...

Backend is PHP-based uses the awesome PHP SlimFramework 3.0, backed with PHPActiveRecord to serve database manipulation tasks, the architecture is very flexible and straight forward to alter with your own preferred ORM library.

Get Started

First thing to do install the generator using npm
npm install -g generator-slimrest-angular
the command will scaffold the project and install dependecies in for both angular and PHP.

First Run

Once generator finishes installing dependencies for both frontend and backend, the project is ready.

Run grunt serve to preview frontend while doing development, no thing new!, for backend run grunt serve:api, API instance will be accessible through http://localhost:9005.

Directory Structure

Application is separated in two directories, directory structure looks like the following:

Directory Structure

Do Backend Development

Backend is based on slimrest API scaffold

Additional Tools

Additional resources and tutorials based on the scaffold will be available soon.

Easy to start

  1. download the code or fork it to your github account.
  2. install dependencies by running ./composer.phar install

note use your own composer install if you already have one 3. update config.php file to meet your system requirements. 4. run through your http php-enabled server, for quick starts, run php -S localhost:9001 from your terminal inside project directory to have quick up and running development instance.

tip Don't use this way in production, deploy in reliable webserver

Getting Started

1. Configure The Database Connection

This scaffold uses PHPActiveRecord to handle database connectivity and manipulation, I've PHPActiveRecord for 3 years, and it is really quick awesome solution if you still using the mysqli or PDO, give it a look.

Configuration is straight in this scaffold, edit your /config.php file to add as many connections as you want,

Note that the 'development' connection is mandatory to be there unless you set the system environment variable 'LIS_ENV' to whatever connection name you want.

Connection string is formatted like:

<DB_DRIVER>://<USER>:<PASS>@<DB_SERVER>/<DB_NAME>

for example mysql://root:root@localhost/database.

models_dir configuration key is critical for PHPActiveRecord to find the model classes, it is set by default to app/Model.

Note if you are going to change where your models will be, point this location to where you are going to place all your models classes

2. Create Your First Route

This scaffold uses the term Resource to describe a single Entity or a Module in your system, you are free to divide your system into Resources, each Resource in your system should be included in the directory Resource and should extend the abstract class \SlimRest\Resource.

Implement the method routes in your own Resource subclass by adding your routes.

<?php
	namespace SlimRest\Resource;
	use \SlimRest\Resource as Resource;
	class Auth extends Resource{
	 public function routes(){
		 $this->get('/login', [$this, 'doLogin']);
		 $this->post('/login', [$this, 'postLogin']);
		 ...
	 }

	 public function doLogin($req, $res, $args){
		 ...
		 return $this->respond($res, ... );
	 }

	 public function postLogin($req, $res, $args){
		 ...
	 }
	}

3. Register Resource in your index file

last thing to do is to register your created resource by creating new instance in /index.php

	new \SlimRest\Resource\Auth();

Try accessing your routes through web browser or Postman

Tutorials will be available soon here.

Tutorials will be available soon.

Sub Generators

No subgenerators added yet in the current generator. However, there is list of planned subgenerators to be added soon.

  • API endpoint
  • Angular Module
  • Angular Controller
  • Angular Route

Contribution

You have something to add?
Simple! fork the repo, apply your changes, and send a Pull request.

Awesome contributors will be listed here.