Download the PHP package javihgil/extra-bundle without Composer

On this page you can find all versions of the php package javihgil/extra-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package extra-bundle

Extra Bundle

Utility services and classes for Symfony projects

Installation

composer require javihgil/extra-bundle ~1.0

Configure Bundle

Register the bundle in app/AppKernel.php:

// app/AppKernel.php
public function registerBundles()
{
    return [
        // ...
        new \Jhg\ExtraBundle\ExtraBundle(),
    ];
}

Controller extension

To use the utilities in ExtraController extend your controllers from Jhg\ExtraBundle\Controller\ExtraController instead of Symfony FrameworkBundle one.

<?php 
namespace AppBundle\Controller;

use Jhg\ExtraBundle\Controller\ExtraController;

class MyController extends ExtraController
{

}

Some usefull methods:

getRepository

$this->getRepository('AppBundle:User')->findBy(...)

trans

$this->trans('Some translatable text');

transChoice

$this->transChoice('{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples', $count);

addFlashTrans

$this->addFlashTrans('error', 'A translatable error message');

Form handlers

Form handler interface

The mission of Form Handlers is to encapsulate CrUD business operations into one proccessor class.

All the forms must be validated, then some action must be done with contained data, and usually those actions are duplicated.

With the use of form handlers all those actions are in one method, and can be called anywhere.

Doctrine Create form handler

Handler for creating doctrine entities in a CRUD controller.

Example

/**
 * @param Request $request
 *
 * @return Response
 */
public function createAction(Request $request)
{
    $element = new Element();

    $form = $this->createForm(new ElementType(), $element);

    if ($this->get('create_form_handler')->process($form, $request)) {
        return $this->redirectToRoute('success_route', ['element', $element->getId()]);
    }

    $viewData = [
        'form' => $form->createView(),
    ];

    return $this->render('ExampleBundle:Element:create.html.twig', $viewData);
}

Doctrine Update form handler

Handler for updating doctrine entities in a CRUD controller.

Example

/**
 * @param Element $element
 * @param Request $request
 *
 * @return Response
 */
public function updateAction(Element $element, Request $request)
{
    $form = $this->createForm(new ElementType(), $element);

    if ($this->get('update_form_handler')->process($form, $request)) {
        return $this->redirectToRoute('success_route', ['element', $element->getId()]);
    }

    $viewData = [
        'element' => $element,
        'form' => $form->createView(),
    ];

    return $this->render('ExampleBundle:Element:update.html.twig', $viewData);
}

Doctrine Delete form handler

Handler for deleting doctrine entities in a CRUD controller.

Example

/**
 * @param Element $element
 * @param Request $request
 *
 * @return Response
 */
public function deleteAction(Element $element, Request $request)
{
    $form = $this->createForm(new ElementType(), $element);

    if ($this->get('delete_form_handler')->process($form, $request)) {
        return $this->redirectToRoute('success_route');
    }

    $viewData = [
        'element' => $element,
        'form' => $form->createView(),
    ];

    return $this->render('ExampleBundle:Element:delete.html.twig', $viewData);
}

All versions of extra-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/config Version ~2.5|~3.0|~4.0
symfony/form Version ~2.5|~3.0|~4.0
symfony/http-foundation Version ~2.5|~3.0|~4.0
symfony/http-kernel Version ~2.5|~3.0|~4.0
symfony/dependency-injection Version ~2.5|~3.0|~4.0
twig/twig Version ^1.9
doctrine/orm Version ^2.2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package javihgil/extra-bundle contains the following files

Loading the files please wait ....