- PHP 100%
| config | add services.yml file | |
| src | code cleanup | |
| .gitignore | init composer | |
| composer.json | update license in composer.json | |
| LICENSE | add license | |
| README.md | updating readme | |
Pixiekat's Symfony Bootstrap Library
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\Lastfmarguments:- '@http.client'- '%env(LAST_FM_API_KEY)%'app_last_fm_manager:class:App\Service\LastFmManagerarguments:- '%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\LastFmNowPlayingExtensionarguments:- '@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_versionsversion_column_name:versionversion_column_length:191executed_at_column_name:executed_atexecution_time_column_name:execution_timemigrations_paths:'App\Migrations':./../migrationsall_or_nothing:truetransactional:truecheck_database_platform:trueorganize_migrations:noneconnection:nullem:nullAdd 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.
Free Palestine. Human beings aren't illegal. Fuck borders.
Contact Me
You can find me on Bluesky mostly. I don't bite. <3