Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cg Laravel Package

jms/cg

jms/cg is a PHP code generation library that builds classes, methods, and properties programmatically. It provides a fluent API plus reflection and metadata support to generate readable source code, useful for proxies, serializers, and other build-time tooling.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Code Generation for Boilerplate Reduction: Accelerates development of repetitive PHP structures (e.g., Doctrine entities, repositories, services) by automating scaffolding, reducing manual coding time by 30–50% for CRUD-heavy applications.
  • Legacy System Modernization: Enables incremental adoption of PHP7 features (e.g., type hints, scalar type declarations) in older codebases without full rewrites, aligning with long-term tech debt reduction.
  • Build vs. Buy: Justifies buying this lightweight tool over custom scripts or full-fledged IDE plugins (e.g., PhpStorm generators) when:
    • Team lacks devops resources to maintain in-house generators.
    • Need for consistent, version-controlled code generation (vs. ad-hoc solutions).
  • Use Cases:
    • Microservices: Rapidly generate DTOs, request/response objects, or API contracts.
    • E-commerce Platforms: Automate product attribute mappings or order workflow classes.
    • Internal Tools: Scaffold admin panels or reporting utilities with predefined templates.

When to Consider This Package

  • Adopt When:
    • Your team frequently writes repetitive PHP classes (e.g., >20% of dev time spent on boilerplate).
    • You’re using Doctrine ORM or need to generate entities/repositories with custom logic.
    • PHP7 migration is a priority, but full rewrites are blocked by business constraints.
    • You prefer composer-based tools over IDE-specific plugins (e.g., PhpStorm’s built-in generators).
  • Look Elsewhere If:
    • You need real-time code generation (this is CLI-based; consider Livewire or Alpine.js for frontend).
    • Your stack uses non-PHP languages (e.g., Node.js, Go) or frameworks with built-in generators (e.g., Laravel’s make:model).
    • You require advanced templating (e.g., Jinja2, Handlebars); this package uses simple string replacements.
    • The last release (2016) is a blocker—evaluate maintenance risk vs. criticality of the feature.

How to Pitch It (Stakeholders)

For Executives:

"This tool cuts development time for repetitive PHP code by automating 40% of boilerplate—think entities, services, or API wrappers—without hiring extra devs. For example, generating 50 Doctrine entities would take 2 hours manually vs. 10 minutes with this. It’s a low-risk, high-ROI way to modernize legacy systems while keeping costs flat. Since it’s open-source and Apache-licensed, we avoid vendor lock-in."

For Engineering:

*"jms/cg is a lightweight, PHP7-compatible code generator that plugs into your existing workflow via Composer. It’s ideal for:

  • Doctrine projects: Auto-generate repositories with custom logic.
  • Legacy PHP: Safely introduce PHP7 features (e.g., typed properties) in incremental steps.
  • Consistency: Enforce team-wide coding standards via templates.

Trade-offs:

  • No active maintenance (last release: 2016), but core functionality is stable for basic use cases.
  • CLI-only: Requires script integration (e.g., in composer.json scripts or CI). Proposal: Pilot it for one high-impact use case (e.g., admin panel scaffolding) and measure time saved."*

Key Metric to Track: "Reduction in dev hours spent on boilerplate code generation."

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
baks-dev/finances
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle