Autoloading classes in PHPUnit using Composer and autoload.php

Well, at first. You need to tell the autoloader where to find the php file for a class. That’s done by following the PSR-0 standard. The best way is to use namespaces. The autoloader searches for a Acme/Tests/ReturningTest.php file when you requested a Acme\Tests\ReturningTest class. There are some great namespace tutorials out there, just search … Read more

CakePHP 3.0 installation: intl extension missing from system

I faced the same problem today. You need to enable the intl PHP extension in your PHP configuration (.ini). Solution Xampp (Windows) Open /xampp/php/php.ini Change ;extension=php_intl.dll to extension=php_intl.dll (remove the semicolon) Copy all the /xampp/php/ic*.dll files to /xampp/apache/bin Restart apache in the Xampp control panel Solution Linux (thanks to Annamalai Somasundaram) Install the php5-intl extension … Read more

How to install Laravel 5.0

As Laravel 5 is already final release, to install it, you should run composer create-project laravel/laravel test-laravel-5-project –prefer-dist in your console. test-laravel-5-project is the name of your project you can call it anyway you want – for example myblog, myapp etc. Laravel files will be put inside this directory You can also use alternative method … Read more

Can composer generate the `composer.lock` without actually download the packages?

If you do not have a composer.lock The answer is “no”, you have to generate the lock file using: composer install Installing Without composer.lock If you have never run the command before and there is also no composer.lock file present, Composer simply resolves all dependencies listed in your composer.json file and downloads the latest version … Read more

Using Composer’s Autoload

Every package should be responsible for autoloading itself, what are you trying to achieve with autoloading classes that are out of the package you define? One workaround if it’s for your application itself is to add a namespace to the loader instance, something like this: <?php $loader = require ‘vendor/autoload.php’; $loader->add(‘AppName’, __DIR__.’/../src/’);

Composer [UnexpectedValueException] error will trying to use composer to install a github project

I started getting a similar error and the reason was that Github recently changed the format of their auth tokens: Authentication token format updates are generally available To resolve the error: Find the composer/auth.json file (if you’re running the project in a container, you’ll have to bash into it and find the file in there) … Read more