定制 pixiekat/symfony-bootstrap 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

pixiekat/symfony-bootstrap

最新稳定版本:1.0.6

Composer 安装命令:

composer require pixiekat/symfony-bootstrap

包简介

A small library to create and bootstrap an application using Symfony components.

README 文档

README

This is a basic library which bootstraps an application using Symfony Components.

Installation

composer require pixiekat\symfony-bootstrap:^1.0 or view the releases page on Codeberg.

Usage

Define your routes for your application.

use Symfony\Component\Routing\Annotation\Route;
#[Route(path: '/foo', name: 'foo', methods: ['GET'])]

Then create the application.

try {
  $app = (new \Pixiekat\SymfonyBootstrap\Bootstrap)->createApplication('dev');
  $response = $app->getResponse(['error_pages_dir' => '/errors']) ;
  $response->send();
}
catch (Exception $e) {
  throw \Exception('Could not bootstrap.');
}

Pull services from the container with $app->getContainer().

Services

You can define services within <root>/config/services.yml. The Application class will read them in when bootstrapping.

services:

  last_fm_client:
    class: Barryvanveen\Lastfm\Lastfm
    arguments:
      - '@http.client'
      - '%env(LAST_FM_API_KEY)%'

  app_last_fm_manager:
    class: App\Service\LastFmManager
    arguments:
      - '%env(LAST_FM_API_KEY)%'
      - '%env(LAST_FM_USER)%'
      - '@cache.app'
      - '@logger'
      - '@last_fm_client'

  app.twig.last_fm_now_playing_extension:
    class: App\Twig\LastFmNowPlayingExtension
    arguments:
      - '@app_last_fm_manager'
      - '@app.cache'
      - '@request'
      - '@logger'
    tags:
      - { name: twig.extension }

Doctrine

Doctrine is available as doctrine.orm.entity_manager or using $app->getDoctrine().

Add your DB connection string as environment variable DATABASE_URL.

Add your migrations.yml to <root>/config/.

table_storage:
  table_name: doctrine_migration_versions
  version_column_name: version
  version_column_length: 191
  executed_at_column_name: executed_at
  execution_time_column_name: execution_time

migrations_paths:
  'App\Migrations': ./../migrations

all_or_nothing: true
transactional: true
check_database_platform: true
organize_migrations: none

connection: null
em: null

Add your Entities to <root>/src/Entity.

Add your Repositories to <root>/src/Repository.

Caveats

This is a very rudimentary project mostly designed for me that's a proof of concept in constant development but feel free to request anything or pull request. :)

License

Anyway this project is licensed under the Anti-Capitalist Software License so basically I don't care if you use this as long as you're not in law enforcement, immigration enforcement, or the military. I am 100% against AI and LLMs, so don't use this package with any combination of those two things either.

Free Palestine. Human beings aren't illegal. Fuck borders.

Contact Me

You can find me on Bluesky mostly. I don't bite. <3

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-04-13