Weave 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

Code Bundle Laravel Package

liip/code-bundle

LiipCodeBundle is a Symfony bundle for displaying and editing source code in your apps. It adds syntax highlighting and code-editor integration, making it easy to embed readable code snippets in templates, documentation, and admin screens.

View on GitHub
Deep Wiki
Context7

Getting Started

Verdict up front: liip/code-bundle is not a Laravel package. It is a deprecated Symfony2 bundle (last release 2015-06-15, archived, 25 stars, 0 dependents). For a Laravel developer, its day-to-day leverage is effectively zero as a dependency; its value is as a small reference implementation for building equivalent Artisan commands.

Minimal steps in a legacy Symfony2 app

  1. composer require liip/code-bundle only if you are maintaining a Symfony 2.x application.
  2. Register the bundle in app/AppKernel.php.
  3. Look first at:
    • README.md for command signatures and editor configuration.
    • Command/ for the actual console commands.
    • DependencyInjection/ and Resources/config/ for service wiring and config keys.
  4. Run app/console list liip:code to discover the available commands.
  5. Configure your editor in config.yml (typically under liip_code:) and try resolving one service or class to a file path, then opening it.

Minimal steps in a Laravel app Do not install it. Instead:

  1. Read the source for command shape and identifier-resolution ideas.
  2. Build a small Artisan command pair: code:find and code:open.
  3. Use Laravel-native resolution:
    • Classes: class_exists() + ReflectionClass.
    • Services: app()->make() / app()->bound().
    • Views: view()->getFinder()->find().
    • Config: config().
    • Routes: Route::getRoutes().
  4. Store editor command in config/code.php.

First use case: resolve a service ID or class name to its absolute file path, then open it in your editor from the terminal. That is the core workflow the bundle was built around, and it is still a useful pattern in Laravel if you implement it yourself.

Implementation Patterns

Legacy Symfony2 usage pattern

The bundle exposes console commands around a common “identifier → file path/class” workflow. The exact command names should be confirmed via app/console list liip:code, but the pattern is:

# Resolve and locate
app/console liip:code:find class "Acme\DemoBundle\Entity\User"
app/console liip:code:find service "acme.demo.service"
app/console liip:code:find template "AcmeDemoBundle:Default:index.html.twig"
app/console liip:code:find bundle "AcmeDemoBundle"

# Open in configured editor
app/console liip:code:open service "acme.demo.service"

Typical configuration:

# config.yml
liip_code:
    editor: phpstorm
    # or an explicit command such as:
    # editor: "phpstorm --line={line} {file}"

Day-to-day workflow

  • Alias the commands in your shell:
    alias sf-find='app/console liip:code:find'
    alias sf-open='app/console liip:code:open'
    
  • Use the resolved path in scripts rather than hardcoding bundle paths:
    path=$(app/console liip:code:find template "AcmeDemoBundle:Default:index.html.twig")
    grep -R "some_marker" "$path"
    
  • Wire it into an editor external tool or a Makefile target for “open this service/class/template”.
  • Use it during onboarding to answer “where does this service ID actually live?” without grepping XML/YAML service definitions.

Porting the pattern to Laravel

A useful Laravel equivalent is roughly 100 lines and avoids legacy Symfony coupling:

// app/Console/Commands/CodeFind.php
protected $signature = 'code:find {type} {name} {--json}';
protected $description = 'Resolve a class, service, view, config key, or route to a file path';

public function handle()
{
    $path = match ($this->argument('type')) {
        'class'   => (new ReflectionClass($this->argument('name')))->getFileName(),
        'service' => (new ReflectionClass(app($this->argument('name'))))->getFileName(),
        'view'    => view()->getFinder()->find($this->argument('name')),
        'config'  => $this->resolveConfigFile($this->argument('name')),
        'route'   => $this->resolveRouteAction($this->argument('name')),
        default   => null,
    };

    if (!$path || !is_file($path)) {
        $this->error("Not found: {$this->argument('name')}");
        return self::FAILURE;
    }

    $this->line($this->option('json') ? json_encode(['path' => realpath($path)]) : realpath($path));
    return self::SUCCESS;
}

Then an code:open command that launches the configured editor:

$template = config('code.editor_command', 'phpstorm --line={line} {file}');
$command = str_replace(['{file}', '{line}'], [escapeshellarg($path), $line ?? 1], $template);
\Symfony\Component\Process\Process::fromShellCommandline($command)->run();

Integration tips

  • Use structured output (--json) so the command can be consumed by editor plugins, fzf, or scripts.
  • Return non-zero exit codes when resolution fails; this makes the command composable.
  • Add a code:find resolver per identifier type rather than a monolithic switch; Laravel’s container and Illuminate\Support\Str make namespace guessing easy.
  • Register the commands in routes/console.php or let Laravel auto-discover them from app/Console/Commands.
  • Use realpath() and handle Windows path separators if the team is mixed-OS.

Gotchas and Tips

  • It is abandoned. Archived, deprecated, last release 2015, zero dependents. Do not add it to a new Laravel or Symfony project. Composer may install it, but compatibility with modern PHP/Symfony/Laravel is not guaranteed and there will be no fixes.
  • Symfony2 assumptions leak everywhere. Bundle notation like AcmeDemoBundle:Default:index.html.twig, XML/YAML service definitions, and the old console API do not map cleanly to Laravel’s Blade views, service providers, and container bindings.
  • No Laravel package discovery. If you somehow install it, Laravel will not auto-register the Symfony bundle. There is no Laravel service provider.
  • Editor shortcuts are environment-specific. Hardcoded editor binaries (phpstorm, subl, code) break on other machines. Prefer a configurable command template with {file} and {line} placeholders.
  • Escape paths. Paths with spaces or shell metacharacters will break naive exec()/shell_exec() calls. Use escapeshellarg() and Symfony\Component\Process.
  • Do not expose open-editor functionality over HTTP. It is a console/developer tool. An endpoint that launches an editor is a security and stability problem.
  • Class resolution has edge cases. Service IDs are not always class names. Private services, aliases, factory-created objects, and parameter placeholders can make “service ID → class file” ambiguous. Fail clearly rather than guessing.
  • Debugging legacy usage: run commands with -vvv, clear the Symfony cache after config changes, confirm the bundle is registered in AppKernel, and check for command-name collisions with other bundles.
  • Debugging your Laravel port: use php artisan code:find class "App\Models\User" as a smoke test, then test views, config, and routes. Add tests for not-found cases and paths containing spaces.
  • Extension point if you must fork: keep the resolver layer separate from the command layer. Add new identifier types as small resolver classes, and keep output machine-readable. But for a Laravel team, a small custom Artisan command is almost always cheaper than forking a 2015 Symfony bundle.
  • Better modern alternatives for the same need: barryvdh/laravel-ide-helper, php artisan tinker, PhpStorm’s Symfony/Laravel plugins, fzf, and simple rg/grep aliases cover most of what this bundle offered.
  • Opportunity score is low (2.01) and overall score is 1.34. Treat this as a historical reference only; the useful takeaway is the “resolve identifier to path and open in editor” command pattern, not the package itself.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core