kitpages/util-bundle

Small common tools used for Kitpages bundles

Installs: 37 175

Dependents: 3

Suggesters: 0

Security: 0

Stars: 4

Watchers: 8

Forks: 2

Open Issues: 0

Type:symfony-bundle

v3.0.2 2013-09-09 12:33 UTC

This package is auto-updated.

Last update: 2024-11-04 19:14:36 UTC


README

Only little methods for common problems :

  • create directories recursively
  • send a file to the browser for a download, sending an image or so what
  • ...

Actually I believe nobody will be interested in including this Bundle in it's project. This bundle is globally deprecated.

It is used mainly by the KitpagesCmsBundle.

WARNING, works only on unix/linux systems.

Installation

If you are using DEPS :

[KitpagesUtilBundle]
    git=https://github.com/kitpages/KitpagesUtilBundle.git
    target=/bundles/Kitpages/UtilBundle

Add Kitpages namespace to your autoloader :

<?php // app/autoload.php

$loader->registerNamespaces(array(
    // ...
    'Kitpages' => __DIR__.'/../vendor/bundles',
));

Enable the bundle in your kernel :

<?php // app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Kitpages\UtilBundle\KitpagesUtilBundle(),
    );
}

Then you can use the service which is named kitpages.util

User's guide

Let's say you are in a controller

<?php

$util = $this->get('kitpages.util');
// create recursively a directory
$util->mkdirr("/tmp/test/foo/bar");
// delete recursively the test directory
$util->rmdirr("/tmp/test");
// send a jpg image to the browser with a 3600 expire time
$util->getFile("/tmp/toto.jpg", 3600)