Skip to content

gosh, why is my vendor directory consuming so much diskspace?

"Saving disk space on your composer projects" was a headline for an older entry I made.
I used this project and figured out it has a lot of bugs because of its "outdateness". Thats why I spend some time to create a build script, build a new "compify.phar" and created a pull request to it. Sadly, no response or action has been done by carlos (also no response on any e-mail).
I did the pull request on 28.07.2015, meaning a lot of water is gone down the river since then.
After waiting and waiting, I gave up and simple added my created "compify.phar" in a project called php project maintenance. As given by the name, this project has to goal to easy up maintenance for php projects ;-).
The, currently, best script inside is updateallrepositories which simple tries to find all git repositories from your current working directory. Inside each directory, it is doing some git stuff and also - since today - using compify to clean up the vendor diskspace. If you want to automate that kind of process, feel free to use it and pull some requests if there is something that can be optimized.

Translate to de es fr it pt ja

CreateEntity Propel Behavior released in version 1.0.0

I am happy to announce the release of Version 1.0.0 of the CreateEntity Behavior for Propel.

Why?

  • no new in your code anymore
  • eases up writing test code (createEntity can be mocked)
Translate to de es fr it pt ja

Saving disk space on your composer projects

Have you ever did a "du -sh" on your vendor folder and became shocked because of the size?
As example, if you require the zend framework 2 in your project, you have to download and store over 170 MB in your disk. Hopefully, you don't think this is the size of the framework.
And you are right, over 150 MB of the size is inside the ".git" folder. That is "nice to know" information if you are a zend framework 2 developer, but if you simple use it, you don't need it.
Thanks to carlos buenos vinos, all you need to do is to download a tool called compify. Once setted up on your machine, you only have to change into your project root and execute "compify crush vendor/".
You can automate that call by binding it with the "composer update" call, either via shell alias, shell script, ant target or phing target (or are you using maven for a php project?).

Translate to de es fr it pt ja

version 1.0.0 of php component cli argument released

I am happy to annoucen the release of 1.0.0 of bazzlines cli argument component for php.
Benefits

  • easy up handling of following kinds of arguments
    • flags (command -f|--force)
    • lists (command --foobar=foo | command -f=foo)
    • values values (command )

Example
A simple call to the shipped "run.php" with the following arguments:

php run.php --foo bar --foobar=foo --foobar="bar" -f="foo" -f=bar -b foobar foo -flag
Generates the following output:

arguments provided:
    --foo
    bar
    --foobar=foo
    --foobar=bar
    -f=foo
    -f=bar
    -b
    foobar
    foo
    -flag
flags provided:
    foo
    b
    f
    l
    a
    g
lists provided:
    foobar
        foo
        bar
    f
        foo
        bar
values provided:
    bar
    foobar
    foo

Translate to de es fr it pt ja

version 1.1.0 of php component requirement released

I happy to announce the release of 1.1.0 of bazzlines requirement component for php. Important changes are:

  • added example WithDisabledCondition
  • added example WithDisabledItem
  • added getConditions() method to RequirementInterface - this easies up disabling single conditions or single items (by using condition->getItems())
  • added migration howto
  • added version eye and scrutinizer coverage
  • covered AbstractItem and AbstractCondition with unit test
  • created AbstractItem that implements ItemInterface
  • created IsDisabledInterface
  • created ItemInterface
  • created TestCase that is extended by all phpunit tests
  • implemented IsDisabledInterface to AbstractCondition
  • implemented IsDisabledInterface to Requirement
  • refactored ConditionInterface, addItem now only accepts ItemInterface instead of IsMetInterface
  • refactored Condition::getItems() - now returns plain php array
  • renamed ConditionAbstract to AbstractCondition
  • renamed and updated previous WithShutdown example to WithDisabledRequirement
  • updated dependencies
Translate to de es fr it pt ja

tool to generate suggestions on potential problems in your php code

PHP-Tricorder is a CLI utility that scans structure files created using phpDocumentor and offers suggestions on potential problems with your code along with testing strategy information.

Executing /path/to/php tricorder.php will give you some usage information.

Please read the file LICENSE included with this code for licensing details.


source

Found it, gave it a try and want to share it.

Translate to de es fr it pt ja

web - Propel 1.7.0 (PHP ORM) released

Just the fixes from the changelog.

2013-10-21: Version 1.7.0 ##


2bb6d2d fix DebugPDOStatement for usage with execute
ceee8a9 fixed a getter function without '$con'
f30aa35 Fixed diff task combined with skipSql
9087851 Fix namespace support
b9a8ad7 Fix small error in the QueryBuilder Doc for TemporalType
a5226c9 fix bug when adding previously removed relations
52d8a76 fix for CASE expression in query with offset in ms sql
0cfa3db Fix accidental type conversion in sluggable behavior.
c1fc85d Fixed issue with migrations and decimal or numeric table size
a6c3218 fix scheduledForDeletion for CrossFK w/ refPhpName
70c18d2 Undefined index fix
2193ba4 Fixed MigrationManager to use queries and charset settings
d37b4cd Fixed object builder toArray withColumn
7e173bc Fixed test assertion
4a5eba2 Fixed Sluggable behavior combining with symfony_i18n
c4b61cc Bugfix for PHP < 5.3.0
f6031de Foreign Keys default behaviors managment (resolves issue #390)
130429f Fix some issues. Closes #684
193f736 Fix a couple of mistakes
3ea2f2d Issue #677: Set back reference when calling add Provided tests for testing if all references are set for crossreferences before saving
4495b9f fixed transaction leak when exception different from PropelException is thrown
3bf0689 fix deleting related objects
8f75133 Fixed #651. Stupid typo.
5b7878a clean
54362ae fixed urls to trac tickets propel.phpdb.org/trac/ticket -> trac.propelorm.org/ticket 75a15f1 fix generated CS of SoftDelete in forceDelete()
937ff8b fix timing issues in TimestampableBehaviorTest
fbc1b3a fix some introspections, coding style
93c6a0f Fixes JOIN duplication issue when default join type equals given join type (issue #373) dcace44 Bugfix for join equality when default join type is used
644931d Fixed typos
efb83ee fixed __clone() for PropelCollections containing scalar values
366e1df fixed test
288e91d Fixed #603


For more information, take a look to the changelog. Thanks to the propel team and have fun to everyone.

Translate to de es fr it pt ja

Disable your requirement, configuration based - php component requirement 1.0.5 released

I'm happy to announce the new release 1.0.5 of my requirement component for php.

This version resolves a feature request (the first official one by the way :-D). With version 1.0.5, you are now able to shutdown a requirement. This leads to the fact that the requirement is not evaluating its internal collections or items. Instead, it returns "true" immediately.

This version is shipped with an example so take a look into it.

Translate to de es fr it pt ja

Easy Up Migration From Existing Log4Php Applications To Psr Logger Applications

It is a bit mean to put such a headline on top, but thats the current status we have to deal with at our company. I also don't want to bash somebody, Log4Php is doing its job in a great way. But since i developed a proxy logger component, i want to use it. The proxy logger component can work with psr logger interface, so i need to create a adapter to get it used ;-).

The psr and log4php adapter is a easy component and provides only two classes.

  • Log4Php to Psr Logger Bridge
  • Psr Logger to Log4PhP Bridge
  • Log4Php Logger Interface

The usage is simple, depending on the way you either choose the adapter "Log4PhpToPsrLoggerAdapter" or "PsrToLog4PhpAdapter". The only drawback, you are loosing the "trace" log level of log4php and all the fancy stuff of a log4php logger. This component is simple and has just a few lines of code (you are welcome to join), so the main focus is to support the log level methods like "$logger->warn()" and not more.

Translate to de es fr it pt ja

PHP Component - Data Type

By using this component, you are able to use type hints also for basic data types.
This component includes class definitions for php basic data types like:

  • Boolean
  • Floating point
  • Integer
  • String
  • Numeric

Features

  • Enables type hints for basic php types
  • Types shipped with useful methods
  • Are comparable with native php types by using "=="
  • Provides generic type casting by implemented "toString()" methods (and so on)

Usage

Example


/**
 * Class with type hint for string
 *
 * @author stev leibelt 
 * @since 2013-08-04
 */
class MyClass
{
    /**
     * @var array
     * @author stev leibelt 
     * @since 2013-08-04
     */
    private $strings = array();

    /**
     * Super cool method with type hint for string
     *
     * @author stev leibelt 
     * @since 2013-08-04
     */
    public function addString(\Net\Bazzline\Component\DataType\String $string)
    {
        $this->strings[] = $string;

        return $this;
    }
}

$myString = new \Net\Bazzline\Component\DataType\String('super cool test string');

$myClass = new MyClass();
$myClass->addString($myString);

Hints

  • Extend provided types with classes in own namespace.
  • If you add a super cool method to your type, push it and be a part of the development team

Install

Via Git


cd path/to/my/git/respositories
mkdir -p stevleibelt/php_component_data_type
cd stevleibelt/php_component_data_type

git clone git://github.com/stevleibelt/php_component_data_type.git .

Via Composer


require: "net_bazzline/component_data_type": "dev-master"

Why?

I started developing this component because of the many casts i have to do while dealing with php's basic data types. As general, i searched the web for existing and easy to use components but could not find them. If you find one, please tell me. Last but not least SplTypes are still experimental.

Translate to de es fr it pt ja

Propel ORM, schema.xml, the missing autoIncrement value and a not working "$propelObject->reload()" with mysql greater 5.1

So i had to evaluate a migration of an existing application from mysql 5.1 to mysql 5.5. Yes i know, the gap between 5.1 and 5.5 is tremendous but the system was working without any problems for a long time of periode.

After switching a test environment from 5.1 to 5.5 there was one unittest failing. What was so special in that given unittest? For a reason, we needed to execute the native propel method "reload" right after a "save". The test was failing because of an empty value for the "id". The representing database table has a column id with an autoincrement flag. With mysql 5.1, everything is working as expected. The id was available after the reload so everything was fine.

After switching to 5.5, no id was available after calling "save". This leads to the fact that propel was failing by executing the "reload" method. Switching back to mysql 5.1 and the error was gone. After search in usergroups, issuepages i still could not find any matching issue or entry. Finally i presentend my problem on the #propel channel in freenode and got some feedback. One guy had experienced the same error in the past. He could remember that this problem occures while switching to mysql 5.3 or 5.4. Niceguy exptom wrote that goosed him with my report and he will give the problem a debug session try.

On the next day, he quickly responded and presented his results. He (if he is a he and not a she) told me he could takle it down to a missleading schema.xml. The column where the error occures had a missing autoIncrement="true" value. I took a look into my current schema.xml and bam same flaw.

The rest is quite easy. Update schema.xml, rerun propel generation and testing. Everything is now working fine. Thanks to exptom again. I guess the schema.xml would have been one of the last areas i had debugged.

Translate to de es fr it pt ja

bash function to search and replace in all files with special extension recursively

Pretty much, the code is below. It is a part of my function collection for the bash.

####

Replaces a string in all files in given path and below

taken from: http://www.cyberciti.biz/faq/unix-linux-replace-string-words-in-many-files/

taken from: http://stackoverflow.com/questions/4437901/find-and-replace-string-in-a-file

taken from: http://stackoverflow.com/questions/7450324/how-do-i-replace-a-string-with-another-string-in-all-files-below-my-current-dir

#

@author stev leibelt artodeto@arcor.de

@since 2013-7-30

#

function netbazzlinereplacestringin_files () { if [[ $# -lt 3 ]]; then echo 'invalid number of arguments provided' echo 'command search replace fileextension [path]' return 1 fi

if [[ $# -eq 4 ]]; then
    find "$4" -name "*.$3" -type f -exec sed -i 's/'"$1"'/'"$2"'/g' {} \;
else
    find . -name "*.$3" -type f -exec sed -i 's/'"$1"'/'"$2"'/g' {} \;
fi

}

Translate to de es fr it pt ja

web - tips and tricks about php filehandling and handling json files

While developing an example for the heartbeat component, i run into problems dealing with file handling in php. The problem comes from race conditions by reading and writing (updating) the same files. I must admit, it still needs some time to solve this problem in a sufficient way, but i'm on it.
Nevertheless, two shiny links where found by my preferred search engine and it would be a shame to not share them.

The first link has the title handling json like a boss in php. The page shows you how to encode and decode json files in php. What i liked very much, it also contains an error handling part. Shame on my side, i was not aware of the jsonlasterror function, now i am :-).

The second link headlines itself PHP File-handling tips and tricks and it contains a lot. I like, that the author puts back the SPLFileObject and SPLFileInfo into the limelight.
Even better, i wasn't aware of the available stream "php://temp". Thank you both!

Translate to de es fr it pt ja

bash function to sync to and from a remote host by using rsync and ssh

I quickly created two bash functions to use rsync and ssh for syncing directories from the local host to a remote host and vice versa.

The two methods are available on my shell function repository. The two methods are called net_bazzline_sync_from_host and net_bazzline_sync_to_host. Enjoy it :-).

####

Uses rsync with ssh to copy data from remote to local host

#

@param string $1 - remote user

@param string $2 - remote host

@param string $3 - source path on remote host

@param string $4 - destination path on local host

#

@author stev leibelt artodeto@arcor.de

@since 2013-07-05

#

function netbazzlinesyncfromhost () { if [[ $# -eq 4 ]]; then USER="$1" HOST="$2" SOURCE="$3" DESTINATION="$4" else echo 'invalid number of variables provided' echo 'command user host source destination' fi

rsync -avz -e ssh $USER@$HOST:$SOURCE $DESTINATION

}

#

Uses rsync with ssh to copy data from local to remote host

#

@param string $1 - remote user

@param string $2 - remote host

@param string $3 - source path on local host

@param string $4 - destination path on remote host

#

@author stev leibelt artodeto@arcor.de

@since 2013-07-05

function netbazzlinesynctohost () { if [[ $# -eq 4 ]]; then USER="$1" HOST="$2" SOURCE="$3" DESTINATION="$4" else echo 'invalid number of variables provided' echo 'command user host source destination' fi

rsync -avz -e ssh $SOURCE $USER@$HOST:$DESTINATION

}

Translate to de es fr it pt ja

web - An ARM emulator written in JavaScript

Arm-js is an ARM emulator written in Javascript. It emulates ARMv7-A and some peripherals of Versatile Express. It can boot Linux 3.6.1 and run busybox processes.

Get Started

1. Download the source code 1. git clone git://github.com/ozaki-r/arm-js.git 2. cd arm-js/ 3. git submodule init 4. git submodule update 2. Execute ruby misc/simple-http-server.rb on terminal 3. Access http://localhost:8080/arm-js.html 4. Push Boot button at the top-left corner to start the emulator

Source

Well, what can i say. Because of freaky projects like that, i started to like javascript more and more :-D.

Translate to de es fr it pt ja