Installation Add the package via Composer (though note the archived status):
composer require beloop/course-bundle
Register the bundle in config/bundles.php:
return [
// ...
Beloop\CourseBundle\BeloopCourseBundle::class => ['all' => true],
];
Database Migrations Run migrations to set up core tables (if included):
php bin/console doctrine:migrations:migrate
Check src/Resources/migrations/ for schema definitions.
First Use Case Create a basic course entity via CLI:
php bin/console make:entity Course --bundle=BeloopCourseBundle
Verify the Course model in src/Entity/Course.php (if auto-generated).
Course Management
use Beloop\CourseBundle\Entity\Course;
use Beloop\CourseBundle\Repository\CourseRepository;
$course = new Course();
$course->setTitle('Laravel Fundamentals');
$course->setDescription('Intro to Laravel');
$entityManager->persist($course);
$entityManager->flush();
$repository = $this->getDoctrine()->getRepository(Course::class);
$courses = $repository->findBy(['active' => true]);
Event-Driven Extensions Subscribe to course lifecycle events (if documented):
// config/services.yaml
services:
App\EventListener\CourseListener:
tags:
- { name: kernel.event_listener, event: course.pre_publish, method: onPrePublish }
API Resource Layer Use Symfony Serializer for course DTOs:
# config/packages/serializer.yaml
resources:
- 'config/serializer/Course.yaml'
Example Course.yaml:
Beloop\CourseBundle\Entity\Course:
attributes:
id: ~
title: ~
description: ~
Dependency Injection
Inject services like CourseManager (if provided):
public function __construct(private CourseManager $courseManager) {}
Archived Status
composer fork beloop/course-bundle).Documentation Gaps
src/Entity/ and src/Repository/ for undocumented features.Doctrine Schema Quirks
course) in migrations.# config/packages/doctrine.yaml
orm:
entity_managers:
default:
mappings:
BeloopCourseBundle: false # Disable if using custom schema
Event System
$events = (new \ReflectionClass(Course::class))->getMethod('prePersist')->getDeclaringClass()->getNamespaceName();
Enable SQL Logging
php bin/console doctrine:query:sql "SELECT * FROM course LIMIT 10"
Check for Deprecated Methods Use PHPStan or Psalm to flag outdated API usage.
Fallback to Core Components If the bundle lacks features, reference the parent beloop/components for alternatives.
Custom Fields
Extend the Course entity via inheritance:
namespace App\Entity;
use Beloop\CourseBundle\Entity\Course as BaseCourse;
class Course extends BaseCourse
{
#[ORM\Column]
private ?string $customField = null;
}
Override Templates
Copy templates/ from the bundle to templates/beloop_course/ in your project.
API Versioning Use Symfony’s API Platform for versioned endpoints:
# config/packages/api_platform.yaml
resources:
Beloop\CourseBundle\Entity\Course:
collectionOperations:
get:
path: /api/v1/courses
How can I help you explore Laravel packages today?