Doctrine 2 need Symfony? - php

I am trying to make Doctrine 2 work. But on the documentation page about the CLI tool, it's including something in Symfony...
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
What * * is that ? Why do you need Symfony to make Doctrine work ?
It seems completely odd to me, but I can't make my mind to download Symfony just for the missing class... Can you help me ?

The doctrine console stuff uses some Symfony Components (which are standalone libraries, packaged separately from the full framework).
So it's nothing strange -- the doctrine team just avoided reinventing a perfectly good wheel.

Installing the DoctrineSymfonyConsole will probably fix it:
pear install doctrine/DoctrineSymfonyConsole
If you installed Doctrine from pear, you probably had errors that were handled gracefully. try installing all dependencies:
pear install -af doctrine/DoctrineORM
Make sure there are no problems. If there are missing packages, it should warn you and you'll want to install those. I've had issues in the past where -a (all dependencies) didn't error if there was a problem installing a dependency, and the install halted even though it reported success.
http://pear.doctrine-project.org/

If you download the latest Doctrine tar.gz file, the Symfony Console comes prepackaged with it. No need to do a separate download. You'll find a folder named Symfony in the Doctrine folder. It has the Console and Yaml components.

Related

How to Deploy a Cake PHP App

I wonder if someone can help me. I've been handed in a Cake PHP app that I need to 1) add minor changes 2) deploy. I've never really worked with Cake before and was wondering whether do I need to anything in order for it to work?
For instance, With a Node app, you need to install modules npm install. With a Rails app you'll likely need to install the gems bundle install.
Is there something similar with Cake? I've set the localhost server, but when I try to access the url I get all sort of errors. Some I've fixed (missing environment settings which I just override the Redis host and port). The latest one is:
{
"exception":{
"class":"MissingControllerException",
"code":404,
"message":"Controller class Controller could not be found.",
"file":"\/Library\/WebServer\/Documents\/php\/oompbe\/vendors\/cakephp\/lib\/Cake\/Routing\/Dispatcher.php",
"line":154,
"trace":[
"#0 \.../app\/webroot\/index.php(109): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))",
"#1 {main}"
]
}
}
PS: What's up with all the crazy \/\/?
PPS: Can I find out the version Cake I'm running?
CakePHP is just php. As most properly done php apps these days it comes with composer. I recommend you to read at least the basics of it's manual. Composer is an awesome tool.
git clone <repo>
cd <reponame>
composer install
If you start a new Cake application the official documentation tells you how to this as well:
composer create-project --prefer-dist cakephp/app [app_name]
If you want to automate things further composer provides you callback scripts. They'll allow you to automate tasks, basically trigger commands, after different actions. This is pretty useful to build assets after a composer update for example. I recommend you to not put lots of commands into that section but instead have dedicated script files you trigger by the callbacks.
Can I find out the version Cake I'm running?
If installed via composer it is usually in vendor/cakephp/cakephp/version.txt. Check the content of that file.

Laravel Juploader bundle using composer

Ok i found in other questions in stackoverflow, that artist bundles are not good any more, that you may use composer. but i cant install juploader.
php artisan bundle:install juploader
USING this trhow:
[InvalidArgumentException]
There are no commands defined in the "bundle" namespace.
http://bundles.laravel.com/bundle/juploader
is this really necesary or i just need to insert the next line in bundle.php (creating one?)
'juploader' => array('handles' => 'upload'),
I need to install juploader, or the best jquery upload file for laravel, that make life easy, XD jaja not more complicated. in the past juploader was easy to install, but im afraid is out of date now.
How can i install this, or maybe there is a newer one that works like charm on 4.1 laravel?

PEAR: Using the framework in a distributable application

I am working on a PHP application that uses many features from PEAR. The app is meant to be distributable kind of like Wordpress but really scaled down.
Now the problem I've run into is that PEAR needs to be installed and configured alongside the PHP server without which my app simply will not function unless the users go through all the painful steps of installing PEAR on their server. Users can very well be newbies or non-technical so it's not an option for them.
Therefore there is a need to somehow package everything PEAR into the application itself. As far as I know it may not be possible.
Are there any alternate solution to this? Any solution at all will help. Thanks..
PEAR installs system wide dependencies which makes things like what you describe hard. Composer on the other hand is exactly what you'd need, because it's a per-project dependency manager with much better support for resolving and installing of dependencies. Basically, compared to Composer, PEAR sucks... it always did, Composer on the other hand rocks!
The first thing I would do for each package you need is to see if it is also provided on https://packagist.org/. If it is, problem solved, include the installation into your build process with composer. If you end up with only a few packages from PEAR, you have several options:
inspire the author to provide it on packagist
make your own mirror on packagist (not recommended but sometimes necessary)
see if the project is on github and install directly from git with composer
install the PEAR package via composer anyways, it's possible.
Short answer: switch to composer!
If you are talking about the PEAR packages or class files, you can put the PEAR packages anywhere you want. Just put the ones you use into a dir within your app dir structure and add that to the include path.

Installing Doctrine 2 With PEAR

I'm a noob to PEAR and Doctrine and got into trouble while trying to install doctrine . From Doctrine's website:
You can install the release through Github, download, PEAR or Composer
Since the 'download' doesn't actually link to anything I tried using PEAR.
In c:\xampp\php\ I ran this line as explained in the website
pear install doctrine/DoctrineCommon-2.3.0
And it seemed to go well. However - where is the package downloaded to ? I need the files themselves since I need to drag them to my CodeIgniter folder.
From Google, this is Doctrine's download page http://www.doctrine-project.org/projects/orm/download which isn't working ...
Have you looked on Google?
Setting up CodeIgniter 2 with Doctrine 2 the right way
Integrating Doctrine 2 with CodeIgniter 2
Also, you can find the last Doctrine 2 ORM version here.

Installing phpspec

I am sure I miss something obvious. But I have problems install and using phpspec. First of all I don't know if I should use phpspec or phpspec2.
I have tried installing like this:
- PEAR (doesn't work)
- git hub (cloning and it gets downloaded okay)
- composer (Seems I only can get dependencies installed)
I would really appreciate if somebody knows a "phpspec for dummies guide".
Or is it just better to use PHPUnit?
Have you seen http://phpspec.net for a start? It describes how to install phpspec. PEAR is not listed as an installation method for phpspec2 and the pear channel is down at the moment for phpspec 1.x, as we, the maintainers, are not sure weather there is an existing user base that justifies maintaining it.
So for now, weather you want to use 1.x or 2alpha, you have to install it with composer.
PEAR Channels are down for over a week and I have received 3 requests, counting you.
If you install phpspec with composer it is of course only a dependency, because first of all you want to test your actual application and second everything you install with composer is a dependency to your application.
Phpspec for dummies guide: http://www.phpspec.net/docs/introduction.html#getting-started

Categories