- Created on Tuesday, 04 February 2014 19:45
Getting started with PSR-4 and composer in your projects
For comments, go to gist.github.com/pavlakis/8810829#file-gistfile1-php
For completeness, I've included one of my comments below:
For efficiency, we shouldn't be including the tests directory on the main namespace. Instead, we can add it to the autoloader but only in the phpunit's bootstrap. (thanks to @noginn for his suggestion)
We can adapt the above example by making three changes:
- In composer.json remove the reference to tests/, save and run composer update
- Create MyApp/tests/bootstrap.php
- $autoloader = require DIR . '/../vendor/autoload.php';
- Change the bootstrap reference in MyApp/tests/phpunit.xml.dist to: bootstrap.php
The above example is available through github: https://github.com/pavlakis/psr4-with-composer
- Created on Saturday, 30 March 2013 23:20
Composer is a great tool for managing the dependencies in your project.
I must admit, I’ve only just started using it and can already see how powerful and easy to use it is.
There are many good articles on how to set it up, so I’ll go over the basics on getting started in your own project with a basic Hello World example.
- Created on Thursday, 07 March 2013 23:42
Having managed to install PHPUnit in my mac at work with no problems, found it odd - to say the least - that I was having so many issues at my personal one.
So here is the issue I was having. I set the $PATH with the location of of PHPUnit but when run phpunit --version, I got a bad request error.
After trying different ways of installing/uninstalling, I fixed it by changing the first line of PHPUnit as it wasn’t pointing to the right location of php.
- Created on Sunday, 03 February 2013 18:58
Having used Dojo for a number of years, I really like its modularity.
I’ve only just started looking into it, so here is a small example with my first steps.
I chose to use Curl.js (https://github.com/cujojs/curl)
The directory structure I’m using is the following:
jQuery_curl |__ lib |__ curl |__ jquery |__ projectA |__ slides |__ styles
I have created a simplified slider with text which you can slide to the left and to the right.
I am using a slide object for the slide’s node and content.
A model for adding some logic
And lastly a script that initialises the slider appThe template is also simple. Just load the two main libraries: curl and jquery and create the base path for your applications:
Here is also the css that goes with it. It is created for four slides. However, we can easily pass the style attribute through the model to make this more js driven.