I've installed the latest version of CakePHP, then installed PHPUnit using PEAR and tried to get access using such link as
http://localhost/[project_name]/test.php
But as a result I've got a message that PHPUnit is not installed. I can't understand what the problem is. Are there any other ways to solve this problem ?
And is it possible not to install PHPUnit, but just copy all its files to, for example, Vendor directory of CakePHP and to use it locally just for one separate project ?
I disagree with Mark. :)
The most easy way to install phpunit systemwide is using composer as described on their installation page:
For a system-wide installation via Composer, you can run:
composer global require 'phpunit/phpunit=3.7.*'
The easiest way in Win is https://github.com/dereuromark/cakephp-phpunit
That is standalone and will all work out of the box with
cake Phpunit.Phpunit install
It has no dependencies outside of CakePHP itself. No composer, no pear no other 3rdparty issues.
If you do have one of those dependencies available, use that one, though.
Note:
As of now the pear channel has been shut down and as such there is only the composer solution to it now. (See other answer)
Related
I have tried to install composer according to the three methods provided by composer's official website. There is no problem in executing composer - V under PHP installation directory. However, if you execute composer - V in any directory in any way, the following error will be reported repeatedly:
This is the error output from the implementation of composer - V and the PHP version number
I don't know if the latest version of composer is not uninstalled and there are residual error. This question has made my head swell. Which international friend can take a look at it!
The problem has been solved. I used the software installation method from the official Composer website. When setting the environment variables, I put the composer path first, and then I can use composer in any directory, although I don't know what happened in the end. This is a screenshot of the environment variables configured in my Windows 10.
I just started my laravel course with laracast. I dont quite understand yet all the enviornment-related things.
I know that Composer is a kind of a program that downloads pre-written scripts to use in your project. But where does it work? On my local machine or on my vagrant homestead box VM? On which of these is it supposed to be installed?
I installed myself vagrant homestead box already but does it contain composer? When I go ssh into my guest machine and go to vagrant#homestead:/vagrant$ path I can see composer.json and composer.lock files, but does it mean that I have composer installed?
Composer is a PHP package manager, like npm for javascript or pip for python. There are many examples of package managers. It's useful, because adding dependencies to your php projects can be a pain, but composer makes it really easy. You just add the dependency to composer.json and you can use it right off the bat.
Composer isn't laravel specific, you can use it in any php project, laravel uses it to manage it's dependencies, laravels dependencies use it to manage their dependencies and so forth.
If nothing else, the composer autoloader is great, so you can use it even if you don't plan on using external packages.
Homestead should come with composer installed. A composer.lock file is generated when you run a composer install or composer update. If you plan on creating or using other php projects on your machine, it's probably a good idea to have composer installed on your machine as well.
I need to install CakePHP 3 in an old-fashioned upload-unzip-run way.
The archive I've downloaded from cakephp/cakephp/tags does not contain the default folders like webroot, Model etc., which means it's not complete.
The official documentation does not cover this. Here's a relevant Github issue I found, but the person ends up still using Composer.
There's also cakephp/app and it seems to include those missing files, but it's not mentioned in cakephp/cakephp's composer.json, and even if I download it I've no idea how to merge the packages.
Packaged app (cakephp/app) releases that include all dependencies (framework (cakephp/cakephp), standard CakePHP plugins (cakephp/debugkit, cakephp/bake, etc), required third party libraries) can be found on GitHub.
https://github.com/cakephp/cakephp/releases
It's the download with the small package symbol, named like cake-3-x-x.zip.
However, it isn't a good idea to ditch the dependency manager, as keeping the code base and the autoloader up to date will be rather tedious, and, no offense, I have my doubts that you'll be able to handle this properly if you don't even know how to stitch the app and cake packages together.
You can install CakePhp 3 without Composer.
You need minimum requirements to install CakePhp 3 and CakePhp 3 boilerplate ( fresh copy of Cakephp 3 ).
You can download CakePhp 3 boilerplate from github.
Requirements
Server
HTTP Server. For example: Apache. Having mod_rewrite is preferred,but by no means required.
PHP 5.4.16 or greater.
mbstring extension
intl extension
Database :
MySQL (5.1.10 or greater)
PostgreSQL
Microsoft SQL Server (2008 or higher)
SQLite 3
All built-in drivers require PDO. You should make sure you have the correct PDO extensions installed.
CakePhp 3 Boilerplate:
Repository Home
https://github.com/cakephp/cakephp/releases
CakePhp 3.1.4
https://github.com/cakephp/cakephp/releases/download/3.1.4/cakephp-3-1-4.zip
CakePhp 3.0.15
https://github.com/cakephp/cakephp/releases/download/3.0.15/cakephp-3-0-15.zip
Download one repository and unzip where you wanted to install it.
You may get one error like ( you may not get error if you are lucky!)
Fatal Error
Cake\Error\FatalErrorException
Error: Class 'Cake\Mailer\Email' not found
File D:\xampp\htdocs\practice\cakephp\cakephp-3-1-4\config\bootstrap.php
Line: 138
Then you have to comment two line in config/bootstrap.php
//Email::configTransport(Configure::consume('EmailTransport'));
//Email::config(Configure::consume('Email'));
And finally you got CakePhp 3 installed.
[I am also new in CakePhp 3.So Please inform me if there are any wrong in my given process.]
Thanks
Use Composer.
Install Composer locally, follow the Cake installation instructions, then upload the created folders to the target webhost.
Easy, For CakePHP 3.x you can just download the release you want from here
https://github.com/cakephp/cakephp/releases (eg. https://github.com/cakephp/cakephp/releases/tag/3.3.16).
For a complete installation select the first download link (.zip)
the other links are just for the src
Just run this command to get a clone of CakePHP 3.10.0
git clone -b 3.x git://github.com/cakephp/cakephp.git
Try simple steps
1. Download XAMPP Server.
2. Install XAMPP server.
3. Go to ..\xampp\php\php.ini and open.
4. Add this line (extension=php_intl.dll) or if exist uncomment.
5. Download Composer setup from https://github.com/composer/windows-setup/releases/
6. Install composer and give php.exe file in path
7. Open cmd and check now php version using command php -v. if its showing php version its means its working.
8. Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
9. Finished folder created in htdocs.
I'm searching for the solution for a day but i have no luck.
I already install Zend Framework on Mac OS 10.9, i also install PHPUnit via pear. But when i tried to create a project it show up a message
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.
This is my pear localtion: /usr/bin/pear
This is my phpunit location: /usr/bin/phpunit
Thank you so much!
How did you install PHPUnit?
It is "just" not included in your include_path - that is it.
You need to add it's base path to the Zend Autoloader - here's how.
composer is also an option as #Eddie Jaoude mentioned.
The main difference between using composer and pear is that pear installs its packages globally and you need to include them in your path (to load them). composer on the other hand installs them locally in the project in your vendors directory and automatically handles auto loading for you.
My hosting provider doesn't allow using Composer or PEAR. Doctrine manual doesn't mention any other way of installing it.
How do I install Doctrine without using PEAR or Composer?
You can visit this page https://github.com/doctrine/doctrine2 and then Download ZIP at the right side of the page. Additional Doctrine related stuff can be found here https://github.com/doctrine and here https://github.com/l3pp4rd/DoctrineExtensions
EDIT: you can also install your vendors with composer locally and upload your vendor folder with your app when you have a production ready version.
You can use PEAR to install the packages locally and then ftp/scp it up to your host: http://pear.php.net/manual/en/installation.shared.php
This way you can use PEAR locally and don't need it on your server.