How to integrate PHP with yoman angular project

I use project using I usually know how to use angularjs with PHP on regular projects.

But I'm confused to use php with yoman.

Where can I create a file .phpand what should I name the area $httpin the controller main.js?

+4
source share
2 answers

If you are using an angular generator, you need two elements:

1 / Let your PHP work, as usual, in a type subdirectory public, so it public/index.phploads when you go tohttp://localhost/

2/ Grunt AngularJS src - public/js/myapp.js public/index.php - <script src="/js/myapp.js></script>

3/ JSON angular, json_encode, :

<?php
header('Content-type: application/json');
echo json_encode($someArray); ?>
?>

grunt-php PHP dev-.

- , AngularJS FlightPHP: https://npmjs.org/package/generator-flightangular - , JavaScript PHP.

+4

API - PHP. PHP AngularJS . , API. REST API, Slim.

http://www.slimframework.com/

+4

All Articles