avro/case-bundle

Symfony2 Case Converter Bundle

Installs: 100 455

Dependents: 1

Suggesters: 0

Security: 0

Stars: 6

Watchers: 3

Forks: 3

Open Issues: 2

Type:symfony-bundle

v0.1.2 2013-01-15 15:24 UTC

This package is not auto-updated.

Last update: 2024-12-18 11:40:39 UTC


README

Convert strings or an array of strings to different case formats.

Supports: camelCase, PascalCase, Title Case, and underscore_case.

Installation

This bundle is listed on packagist.

Simply add it to your apps composer.json file

    "avro/case-bundle": "0.1.2"

Enable the bundle in the kernel:

// app/AppKernel.php

    new Avro\CaseBundle\AvroCaseBundle

Configuration

avro_case:
    use_twig: false #disable the twig extension (true by default)

Usage

$converter = $this->container->get('avro_case.converter');

$camelCaseFormat = $converter->toCamelCase($str);
$pascalCaseFormat = $converter->toPascalCase($str);
$titleCaseFormat = $converter->toTitleCase($str);
$underscoreCaseFormat = $converter->toUnderscoreCase($str);

The following filters are also available if you use Twig

    {{ var | camel }}
    {{ var | pascal }}
    {{ var | title }}
    {{ var | underscore }}