Skip to content

php pdo library that adds array quoting as feature

I was searching for a php library that extends PDO in that way, that I don't have to rewrite the "quote each entry in an array on its own by calling "$pdo->quote($value)" again and a gain.
Thanks to the community, there is one small library taking care about this problem - Aura.Sql.
I'm tired today but I will give it a try tomorrow. It is looking very usefull.

Translate to de es fr it pt ja

New versions of the zend framework 2 console helper family available now

I happy to announce the release of 1.1.0 of bazzlines zend framework 2 console helper (debian backport) module for php as well as the release of 1.1.0 of bazzlines zend framework 2 console helpermodule for php.
Important changes are:

  • added AbstractConsoleControllerFactory
Translate to de es fr it pt ja

Updated Zend Framework 2 Modules because of the locator generator version 2.0.0 release

I announced already, version 2.0.0 of the "locator generator" is out.
Because of that, I am also happy to announce the release of 1.4.1 from the zend framework 2 "locator generator" module.
Furthermore, the debian 6/PHP 5.3 backport got the release of version 1.3.0.
And finally, and because of the fact that zend framework 2.5.* is dropping support for PHP 5.4, the new debian 7/PHP 5.4 got the release of version 1.7.0.
Major changes in all releases is the dependency update to the new locator generator version.

You want to have a quick look and tryout without any hassle? Try the zf demo environment available in three flavors, cutting edge, debian 7/PHP 5.4 backport and debian 6/PHP 5.3 backport.

Translate to de es fr it pt ja

php - zfcampus/zf-rest how to | tutorial

Assuming you are using the Zend Framework 2 and want to implement a REST endpoint in a quick and fully functional way.
ZF-Rest is, more or less, the official rest module for zf2. But, the documentation is not available - nor planned right now. Thats why I this blog entry will boost your knowledge and speed up the time until you have finished your first zf2 rest endpoint.

Installation and Setup

add the following line to you composer.json

"zfcampus/zf-rest": "1.0.3"

You need to add the following entries in your to "config/autload/application.config".


<?php

return array( 'modules' => array( //your modules 'ZF\ApiProblem', 'ZF\ContentNegotiation', 'ZF\Hal', 'ZF\MvcAuth', 'ZF\OAuth2', 'ZF\Rest' );

Minimal Configuration (module.config.php)

array key "zf-rest"


//MyRestController is a virtual Controller 
'My\Module\Namespace\MyRestController' => array(
    //mandatory - available are GET, POST, PUT, PATCH, DELETE
    'collectionhttpmethods'       => array(
        'GET'
    ),
    //mandatory - available are GET, POST, PUT, PATCH, DELETE
    'entityhttpmethods'           => array(
        'GET'
    ),
    //virtual name - its the name the collection entries are getting in the HAL-repesentation
    'collectionname'               => 'items',
    'routename'                    => 'myrestroutename',
    'routeidentifiername'         => 'id',
    //this is the only file you really need to code/implement
    'listener'                      => 'My\Module\Namespace\MyListener'
),

array key "router/routes"


'myrestroutename' => array(
    'type' => 'Zend\Mvc\Router\Http\Segment',
    'options' => array(
        'route' => '/my/rest/endpoint/[/:id]',
        'defaults' => array(
            //MyRestController is a virtual Controller
            //The name is needed to map the module configuration to the endpoint
            'controller' => 'My\Module\Namespace\MyRestController'
        )
    ),

Optional Configuration Values

Based on the source code from RestControllerFactory.php, following configuration keys are optional (mention as mandatory in the current README.md).

  • resourceidentifiers
  • identifier
  • controllerclass
  • entityclass
  • collectionclass
Translate to de es fr it pt ja

version 1.0.1 of process pipeline component for php released

I happy to announce the release of 1.0.1 of bazzlines process pipeline component for php. Important changes are:

  • removed dependecy to apigen
  • add "StopExecutionException"
Translate to de es fr it pt ja

version 1.0.2 of zend framework 2 console helper (debian 6 backport) released

I happy to announce the release of 1.0.2 of bazzlines zend framework 2 console helper (debian backport) module for php. Important changes are:

  • removed dependency to apigen
  • updated dependencies
Translate to de es fr it pt ja

version 1.3.3 of zend framework 2 locator generator released

I happy to announce the release of 1.3.3 of bazzlines zend framework 2 locator generator module for php. Important changes are:

  • updated dependencies
  • removed apigen dependency
  • fixed dependency issue
  • added factory for controller creation
  • updated to locator generator 1.4.0
  • added documentation @todo - add link
  • added migration
  • added link to debian 6 / zend framework 2.2 backport
  • prefixed console commands with "net_bazzline" to not pollute the available command environment
Translate to de es fr it pt ja

version 1.0.3 of zend framework 2 console helper released

I happy to announce the release of 1.0.3 of bazzlines zend framework 2 console helper module for php. Important changes are:

  • removed apigen dependency
  • added use statement into example
  • added link to demo environment
  • added link to debian 6 / zend framework 2.2 backport
  • added minimum version of zend framework 2 to 2.3.* since AbstractConsoleController is mandatory
  • updated dependencies
Translate to de es fr it pt ja

version 1.2.2 of zend framework 2 locator generator (debian 6 backport) released

I happy to announce the release of 1.2.2 of bazzlines zend framework 2 locator generator module for php. Important changes are:

  • added factory for controller creation
  • added migration
  • update dependencies
  • removed dependency from apigen
Translate to de es fr it pt ja

version 1.0.3 of command component for php released

I am happy to announce the release of 1.0.3 of bazzlines command component for php. This component will easy up the usage of system commands.
Major improvement is the public method "validateSystemEnvironment". You should use this (maybe in your factory) to validate if the system environment is valid (e.g. "/usr/bin/ls" exists and is executable). An exception should be thrown, so you can easily track back the source of the validation error.
Enjoy it.

Translate to de es fr it pt ja

version 1.0.2 of command component for php released

I am happy to announce the release of 1.0.2 of bazzlines command component for php. This component will easy up the usage of system commands.
Indeed, I missed to announce 1.0.0, but you know, christmas is hard time and this component is really a small one.
This project aims to deliver a easy to use php command component. It adds a very thin layer but hopefully adds a lot of usage and handling benefits :-).

Usage


usage Net\Bazzline\Component\Command\Command;

class Zip extends Command { /** * @param string $archiveName * @param array $items * @return array * @throws RuntimeException * @todo implement parameter validation */ public function zip($archiveName, array $items) {
$command = '/usr/bin/zip -r ' . $archiveName . ' ' . implode(' ' , $items);

    return $this->execute($command);
}

/** 
 * @param string $pathToArchive
 * @param null|string $outputPath
 * @return array
 * @throws RuntimeException
 * @todo implement parameter validation
 */
public function unzip($pathToArchive, $outputPath = null)
{   
    if (!is_null($outputPath)) {
        $command = '/usr/bin/unzip ' . $pathToArchive . ' -d ' . $outputPath;
    } else {
        $command = '/usr/bin/unzip ' . $pathToArchive;
    }

    return $this->execute($command);
}

/** 
 * @param string $pathToArchive
 * @return array
 * @throws RuntimeException
 * @todo implement parameter validation
 */
public function listContent($pathToArchive)
{   
    $command = '/usr/bin/unzip -l ' . $pathToArchive;

    return $this->execute($command);
}

}

$zip = new Zip();

$pathToZipArchive = '/tmp/my.zip';

echo 'list archive content' . PHPEOL; $lines = $zip->listContent($pathToZipArchive); foreach ($lines as $line) { echo $line . PHPEOL; }

echo 'unzip archive' . PHPEOL; $zip->unzip($pathToZipArchive, '/tmp/mydirectory');

echo 'zip directory' . PHPEOL; $zip->zip($pathToZipArchive, array('/tmp/mydirectory'));

How to install?

By Hand


mkdir -p vendor/netbazzline/phpcomponentcommand
cd vendor/netbazzline/phpcomponentcommand
git clone https://github.com/bazzline/phpcomponentcommand .

With Packagist


composer require netbazzline/phpcomponent_command:dev-master
Translate to de es fr it pt ja

version 1.0.0 of process pipeline component for php released

I happy to announce the release of 1.0.0 of bazzlines process pipeline component for php. This component will easy up the creation of process pipe.

Indeed, it is a pseudo pipeline (process collection or process batch) since the php process is single threaded so far.

Special thanks to Ralf Westphal and especially for his book the architects napkin.

Why?

  • separate complex operations into simpler
  • easy up unit testing for smaller processes
  • separate responsibility (data generator/transformer/validator/flow manipulator)
  • create process chains you can read in the code (separate integration code from operation code)
  • no dependencies (except you want to join the development team)

How to use?


use Net\Bazzline\Component\ProcessPipe\ExecutableException;
use Net\Bazzline\Component\ProcessPipe\InvalidArgumentException;
use Net\Bazzline\Component\ProcessPipe\Pipe;

try { $pipe = new Pipe();

$pipe->pipe(
    new ProcessOne(), 
    new ProcessTwo()
);

$output = $pipe->execute($input);

} catch (ExecutableException) { //handle process exception } catch (InvalidArgumentException) { //handle pipe exception }

How to install?

By Hand


mkdir -p vendor/netbazzline/phpcomponentprocesspipe
cd vendor/netbazzline/phpcomponentprocesspipe
git clone https://github.com/bazzline/phpcomponentprocesspipe

With Packagist


composer require netbazzline/phpcomponentprocess_pipe:dev-master
Translate to de es fr it pt ja

version 1.0.0 of zend framework 2 console helper (debian 6 backport) released

I am happy to announce the release of 1.0.0 of bazzlines zend framework 2 console helper module for php.
It is a backport of the existing locator generator module.

Translate to de es fr it pt ja

version 1.0.0 of zend framework 2 locator generator (debian 6 backport) released

I am happy to announce the release of 1.0.0 of bazzlines zend framework 2 locator generator module for php.
It is a backport of the existing locator generator module.

Translate to de es fr it pt ja

Version 1.0.0 of Jetbrains PhpStorm Installer for (Debian) Linux released

I started getting tired of installing phpstorm by hand again and again. Did I mention that installing is the same as updating?.
Since the ide is for php, of course I wrote the installer in php.

simple install or update

php phpstorm.php path/to/linux/php/version.tar.gz

install or update and change group

good if you created a "developer" group on your system

php phpstorm.php path/to/linux/php/version.tar.gz yourgroupname

I hope you are going to enjoy it.

Translate to de es fr it pt ja

version 1.1.0 of zend framework 2 locator generator released

I happy to announce the release of 1.1.0 of bazzlines zend framework 2 locator generator module for php. Important changes are:

  • prefixed console commands with "net_bazzline" to not pollute the available command environment
Translate to de es fr it pt ja

version 1.0.1 of zend framework 2 locator generator released

I happy to announce the release of 1.0.1 of bazzlines zend framework 2 locator generator module for php. Important changes are:

  • fixed links in readme
  • fixed namespace issue in test
  • added usage of zf console helper
  • updated dependencies
  • updated usage
Translate to de es fr it pt ja

version 1.0.1 of zend framework 2 console helper released

I happy to announce the release of 1.0.1 of bazzlines zend framework 2 console helper module for php. Important changes are:

  • added example code output
  • added apigen
  • moved to usage of "Zend\Mvc\Controller\AbstractConsoleController"
Translate to de es fr it pt ja

version 1.0.0 of zend framework 2 console helper released

I happy to announce the release of 1.0.0 of bazzlines zend framework 2 console helper module for php.
This module should easy up implementing console commands supporting POSIX Signal Handling.
Furthermore, there are some simple but useful methods implemented:

  • getConsole()
  • getParameter($name)
  • getRequest()
  • hasBooleanParameter($shortName = '', $longName = '')
  • hasParameter($name)
  • throwExceptionIfNotCalledInsideAnCliEnvironment()

How can I use it?


namespace MyModule\Controller\Console;

use Exception;

class IndexController extends AbstractConsoleController { public function indexAction() { try { $this->throwExceptionIfNotCalledInsideAnCliEnvironment();

        $this->attachSignalHandler($this);

        //some example items
        //  simple think about a lot of items that indicates longer
        //  processing runtime
        $items = array('one', 'two', 'three', 'four');

        //use implemented method to react on signal handling
        $this->processItems(
            $items,             //big list of items
            $this,              //current object
            'processItem',      //method that should be called for each item
            $arguments = array( //additional arguments for method 'processItem' (if needed)
                'foo',
                'bar'
            )
        );
    } catch (Exception $exception) {
        $this->handleException($exception);
    }
}

/**
 * must be protected since it will be called from the parent
 *
 * @param string $item
 * @param string $stringOne
 * @param string $stringTwo
 */
protected function processItem($item, $stringOne, $stringTwo)
{
    $console = $this->getConsole();
    $console->writeLine(
        'this is item "' . $item .
        '" with string one "' . $stringOne . '"' .
        '" and string two "' . $stringTwo . '"'
    );
}

/**
 * @return boolean
 */
private function beVerbose()
{
    return $this->hasBooleanParameter('v', 'verbose');
}

}

How can I install it?

with packagist


composer require netbazzline/zfconsolehelper:dev-master

manuel


mkdir -p vendor/netbazzline/zfconsolehelper
cd vendor/netbazzline/zfconsolehelper
git clone https://github.com/zfconsole_helper
Translate to de es fr it pt ja

version 1.0.0 of zend framework 2 locator generator released

I happy to announce the release of 1.0.0 of bazzlines zend framework 2 locator generator module for php.
This module should easy up the usage of the locator generator component in the zend framework 2 in a zend framework 2 application.

How ca I use it?

generate one locator

php public/index.php locator generate

generate all available locators

php public/index.php locator generate

How can I install it?

with packagist


composer require netbazzline/zflocatorgenerator:dev-master

manuel


mkdir -p vendor/netbazzline/zflocatorgenerator
cd vendor/netbazzline/zflocatorgenerator
git clone https://github.com/zflocator_generator
Translate to de es fr it pt ja

version 1.0.0 of php locator generator component released

I happy to announce the release of 1.0.0 of bazzlines locator generator component for php.

What is it good for?

  • adds back implicit api calls to your locator ("getMyObject()" instead of "get('MyObject')")
  • configuration based driven, update your configuration and generate a new locator
  • generated code is easy to debug
  • generated code is easy to understand (no magic inside)
  • generate a locator out of your propel1 schema.xml

How ca I use it?


cd 
php bin/generateLocator.php example/ArrayConfiguration/configuration.php
ls data/
vim data/FromArrayConfigurationFileLocator.php

How can I install it?

with packagist


composer require netbazzline/phpcomponentlocatorgenerator:dev-master

manuel


mkdir -p vendor/netbazzline/phpcomponentlocatorgenerator
cd vendor/netbazzline/phpcomponentlocatorgenerator
git clone https://github.com/bazzline/phpcomponentlocator_generator
Translate to de es fr it pt ja

version 1.0.1 of php time limit manager component released

I happy to announce the release of 1.0.1 of bazzlines time limit manager component for php. Important changes are:

  • add getRuntimeIn[Seconds|Minutes|Hours]
  • extended unit tests by covering setting of the buffer
  • added getter for minutes and hours
  • updated dependencies
Translate to de es fr it pt ja