承接 mgdsoft/symfony-profiler-spa 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mgdsoft/symfony-profiler-spa

最新稳定版本:v1.0.6

Composer 安装命令:

composer require mgdsoft/symfony-profiler-spa

包简介

Symfony profiler enabled from vanilla js

README 文档

README

Symfony Sersion php Version Licence

This bundle allows you to integrate the Symfony profiler bar into your preferred JavaScript framework.

example

Here's a quick installation guide

Install the bundle into your API PROJECT

composer req mgdsoft/symfony-profiler-spa --dev

Add the new route to your API PROJECT:

# config/routes/web_profiler.yaml when@dev: mgd_profiler_spa: resource: '@SymfonyProfilerSPABundle/Resources/config/routing/routing.yml' prefix: /

Create the asset or copy if you are not using asset component:

bin/console assets:install

This execution will copy 'load_toolbar_spa.js' file to your public folder, you only have to include it in your html file to your FRONTEND project:

<script src="//yourdomain.lol/bundles/symfonyprofilerspa/load_toolbar_spa.js"></script>

That's all! The load_toolbar_spa.js is created in vanilla JavaScript, so it's available for use in all frameworks and libraries. Interceptors available for XHR and fetch.

JS Config

For custom url toolbar you have to use this custom attribute data-url-toolbar

<script src="//yourdomain.lol/bundles/symfonyprofilerspa/load_toolbar_spa.js" defer data-url-toolbar="{ORIGIN}/internal/toolbar/{TOKEN}"></script>

How it works

If you take a look inside src/Resources/public/load_toolbar_spa.js, you'll find a simple script that creates an HTTP interceptor. The first x-debug-token-link header it detects will trigger a request to the API server to retrieve the profiler.

example

Repo demo

Here is a repository installed and ready for testing: https://github.com/MGDSoft/symfony-profiler-spa-demo

Trouble with CORS

Dont forget your nginx configuration to avoid cors

add_header Access-Control-Allow-Origin "http://yourdomain.lol"; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization, x-debug-token-link, X-Debug-Token"; add_header Access-Control-Expose-Headers "X-Debug-Token, X-Debug-Token-Link";

Cool things

Don't forget to configure your IDE to open errors/controllers, and for more information, please visit https://symfony.com/doc/current/reference/configuration/framework.html#ide. If you have trouble configuring PHPStorm, you can use this snippet for a quick solution.

parameters: env(SYMFONY_IDE): "javascript: (function () { let file = '%%f'; file = file.replace('/var/www/your-project/', ''); let newUrl = 'http://localhost:63342/api/file?file='+file+'&line=%%l'; fetch(newUrl); })()" framework: ide: '%env(SYMFONY_IDE)%'

Replace /var/www/your-project/ with the current path of your project. It works using relative paths, so it will work in Docker. For more information, please visit https://www.develar.org/idea-rest-api/."

Enjoy!

统计信息

  • 总下载量: 18.72k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 3
  • Forks: 2
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固