当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

angular-symfony

Project Bootstrap for an Angular + Symfony project
授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 景俊语
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

angular-symfony

Project Bootstrap for an Angular 2+ and Symfony 4+ webservices project.

Introduction

This project is a template application with a secured RestFul API communication via JWT security scheme.

Buy me a coffee

Buy me a coffee

I'm working on this project in my free time and offering it free of charges. To help me work more on this you can send me tips to buy more coffee :)

Installation

Install docker and docker-compose.

Clone the project :

git clone git@github.com:FlyersWeb/angular-symfony.git

Launch dockerized environment :

docker-compose up -d

Log in application docker image :

docker-compose exec application bash

Install dependencies :

composer install

Create database if necessary :

php bin/console doctrine:database:create

Create schemas (FOSUserBundle) :

php bin/console doctrine:schema:create

Create and activate user :

php bin/console doctrine:fixtures:load

Access the front end using port 4200 :

firefox http://localhost:4200 &

Launching tests

If you want to contribute to project you'll need to have tests to pass. So in order to run them you'll need to :

Log in application docker image :

docker-compose exec application bash

Update database connection information in .env.test

Create database :

php bin/console doctrine:database:create --env=test

Create schemas (FOSUserBundle) :

php bin/console doctrine:schema:create --env=test

Create and activate user :

php bin/console doctrine:fixtures:load --env=test

Copy Phpunit config :

cp phpunit.xml.dist phpunit.xml

Launch tests using :

bin/phpunit

Authentication system

The Authentication system is based on the JWT token as implemented by Lexik

User management is done through FOSUserBundle, you can easily add / edit / delete users by using their API.

The server provides a Rest API using FOSRestBundle allowing you to connect using the following query:

curl -X POST -H "Content-Type: application/json" http://localhost:8000/api/login_check -d '{"username":"bob","password":"Abc123"}'

Client Side specifics

On the client side, I've inspired my code from Angular official documentation about HttpInterceptor, allowing me to send the JWT Token on each HTTP request when token is available.

The token is sent in Authorization headers:

Authorization: Bearer xxx

LICENSE

This program is free software. It comes without any warranty, to the extent permitted by applicable law.

This software is LICENSED under the MIT License. Use it at your own risk.

WARNING

Servers are configured for developments purposes. Do not deploy this project on production as is. You should have a look to Symfony deployment documentation for the Back-end and the Angular deployment documentation for the Front-End part.

You should also change the preconfigured keys for signatures by generating your own keys using :

openssl genpkey -out config/jwt/private.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096openssl pkey -in config/jwt/private.pem -out config/jwt/public.pem -pubout

And copy the passphrase into the field JWT_PASSPHRASE in .env file.

You should also update the APP_SECRET in .env file.

Conclusion

You can use this template and adapt it to your needs.

@FlyersWeb

  • php-Symfony2 AJAX登录 我有一个示例,尝试使用Symfony2和FOSUserBundle创建AJAX登录。 我在security.yml文件中的onAuthenticationFailure下设置了自己的success_handler和onAuthenticationSuccess。 这是课程: class AjaxAuthenticationListener implement

  • Symfony Vue 教程展示了如何使用 Vue 前端创建一个简单的 Symfony 应用。 Symfony Symfony 是一组可重用的 PHP 组件和一个用于 Web 项目的 PHP 框架。 Symfony 于 2005 年发布为免费软件。Fabien Potencier 是 Symfony 的原始作者。 Symfony 的灵感来自 Ruby on Rails,Django 和 Sprin

 相关资料
  • Angular 是一款十分流行且好用的 Web 前端框架,目前由 Google 维护。这个条目收录的是 Angular 2 及其后面的版本。由于官方已将 Angular 2 和之前的版本 Angular.js 分开维护(两者的 GitHub 地址和项目主页皆不相同),所以就有了这个页面。传送门:Angular.js 特性 跨平台 渐进式 Web 应用 借助现代化 Web 平台的力量,交付 app

  • 即将到来的Angular 2框架是使用TypeScript开发的。 因此Angular和TypeScript一起使用非常简单方便。 Angular团队也在其文档里把TypeScript视为一等公民。 正因为这样,你总是可以在Angular 2官网(或Angular 2官网中文版)里查看到最新的结合使用Angular和TypeScript的参考文档。 在这里查看快速上手指南,现在就开始学习吧!

  • 从头开始创建项目 lint你的代码 运行您的单元测试和端到端测试。 Angular 2 CLI目前只在TypeScript中生成框架,稍后还会有其他版本。

  • 这小节内容是译者加的,因为我认为对于新手而言,学习一个框架是有成本的,特别是对于一个不算简单的技术来说,我希望这篇教程是对新手友好的,所以我首先要让你放心的将时间和精力投入到Angular2 中。那我们先不谈技术细节,先用数据说话。 这里我多说一句,最近看一些文章中谷歌趋势截图,大都没有把范围限定在“编程”上。图中可以看出Vue2非常少,所以在下面比较中不再单独统计。 教程数量 这里我选取的主要是

  • 我们已经在Highcharts Configuration Syntax一章中看到了用于绘制图表的配置 。 下面给出角度计图表的示例。 配置 (Configurations) 现在让我们看一下所采取的其他配置/步骤。 chart.type 将图表类型配置为基于计量。 将类型设置为“规格”。 var chart = { type: 'guage' }; pane 此类型仅适用于极坐标图和角度

  • 角度计图表用于绘制仪表/仪表类型图表。 在本节中,我们将讨论不同类型的角度计图表。 Sr.No. 图表类型和描述 1 角度计 角度表。 2 实心仪​​表 实心图表。 3 Clock 时钟。 4 带双轴的仪表 带双轴的仪表图。 5 VU表 VU表图表。

  • Highcharts Angular 是我们基于 Angular 框架封装的 Highcharts,可以很方便的在 Angular 开发环境中使用 Highcharts 创建交互性图表。 开发环境 确保您的 node, NPM, Angular 已经更新到最新版本。以下是经过测试和要求的版本: node 6.10.2+ npm 4.6.1+ @angular/cli 6.0.0+ Highchar

  • Angular Kickstart 是基于 AngularJS,GulpJS 和 Bower 的完整可伸缩构建系统,能加快 AngularJS 应用的开发。开发者只需关注代码的编写和测试,剩下的工作 AngularJS Kickstart 会帮忙完成。 特性: 5 个简单的任务:gulp serve,gulp serve:dist, gulp serve:tdd, gulp test:unit,