PHPackages                             theodordiaconu/geshi-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. theodordiaconu/geshi-bundle

AbandonedArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

theodordiaconu/geshi-bundle
===========================

Symfony GeshiBundle

1423PHP

Since Mar 29Pushed 13y ago1 watchersCompare

[ Source](https://github.com/theodorDiaconu/geshi-bundle)[ Packagist](https://packagist.org/packages/theodordiaconu/geshi-bundle)[ RSS](/packages/theodordiaconu-geshi-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

DTGeshiBundle
=============

[](#dtgeshibundle)

Add in the composer

```
requires: {
    // ...
    "theodordiaconu/geshi-bundle" : "dev-master",
}
```

In the app/AppKernel.php file

```
$bundles = array(
    // ...
    new DT\Bundle\GeshiBundle\DTGeshiBundle(),
);
```

How to use
==========

[](#how-to-use)

After you have plugged it in your Symfony2 Application you have several ways to use this:

Twig
----

[](#twig)

```
{{ block_of_code|geshi_highlight('javascript') }}

{{ geshi_highlight(block_of_code, 'javascript') }}
```

PHP
---

[](#php)

#### To get the highlighter

[](#to-get-the-highlighter)

```
$highlighter = $this->get('dt_geshi.highlighter');
```

#### Simple highlighting

[](#simple-highlighting)

```
$highlighted = $highlighter->highlight('Please highlight me!', 'html');
```

#### To create a response that highlights everything automatically for you

[](#to-create-a-response-that-highlights-everything-automatically-for-you)

```
public function indexAction()
{
    // ...
    return $highlighter->createResponse('Hello', 'html');
    return $highlighter->createResponse('This is the line with the error', 'html', 500);
}
```

#### Also, for bad ass people I have also plugged in another method:

[](#also-for-bad-ass-people-i-have-also-plugged-in-another-method)

```
$response = $highlighter->createJSONResponse(array('hello' => 'there'));
```

#### If you want flexibility in configuring the output, you've got it.

[](#if-you-want-flexibility-in-configuring-the-output-youve-got-it)

```
$highlighted = $highlighter->highlight(
    'Please highlight me!',
    'html',
    function(\GeSHi\GeSHi $geshi){
        $geshi->set_header_type(GESHI_HEADER_NONE);
    }
);
```

#### How to set default options to GeSHi

[](#how-to-set-default-options-to-geshi)

```
$highlighter->setDefaultOptions(function($geshi){
    /** @var $geshi \GeSHi\GeSHi */
    $geshi->set_header_type(GESHI_HEADER_NONE);
});

// the highlighting will proceed using the settings from the Default Options
$highlighted = $highlighter->highlight('Please highlight me!', 'html');
// or
$highlighter->createResponse('Hello', 'html');
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1814863?v=4)[Theodor Diaconu](/maintainers/theodorDiaconu)[@theodorDiaconu](https://github.com/theodorDiaconu)

---

Top Contributors

[![theodorDiaconu](https://avatars.githubusercontent.com/u/1814863?v=4)](https://github.com/theodorDiaconu "theodorDiaconu (16 commits)")

### Embed Badge

![Health badge](/badges/theodordiaconu-geshi-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/theodordiaconu-geshi-bundle/health.svg)](https://phpackages.com/packages/theodordiaconu-geshi-bundle)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
