I installed a new symfony 2.4 project and I installed also phpDocumentor using composer.phar folowing these steps:
1- Adding:
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*"
} to My composer.json
2- Executing : php composer.phar update
After installation terminated I can see phpdocumentor Folder in /vendor so I guess installation is terminated with success.
Now I want to know how to use phpDocumentor on symfony (generate a documentation for my code source).
I work on Ubuntu web server.
Thank you and sorry for my bad english.
STEP 1. Add a dependency to phpdocumentor/phpdocumentor to the require-dev section of your project's composer.json configuration file, and update your application.
{
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*"
}
}
STEP 2. Run composer update command inside your project
STEP 3. Go to vendor\phpdocumentor\phpdocumentor\bin directory of your project from CMD and then run following command to generate document of AppBundle/Controller folder code. This will generate document of your AppBundle/Controller folder at \phpdocumentor\phpdocumentor\bin\doc destination.
Command:- php phpdoc run -d ../../../../src/AppBundle/Controller/ -t doc/
Related
I have been trying to move my laravel app to production. I following below steps
1. git clone
2. composer install
3. set env variables
4. (artisan key:generate)
5. artisan migrate --seed
But when i ran composer install, am getting the following error
Class 'Collective\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
I know this error means, laravelcollective not added in composer.json and need to following steps as mentioned here
But i already have done the same thing in dev mode and now the composer.json has require "laravelcollective" and aliases in config/app.php.
My question is, do i need to the same thing what i have done in dev (resolving laravelcollective issue) for every new production instance that i am gonna set it up ?
if your project working fine locally, then you have to Run composer update commend under your project repo. did you uploaded vender folder?
Also try to upload(only) vender/composer folder into your vender, and then try to runcomposer installorupdate` command
update it in your composer.json file.
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laravelcollective/html": "5.1.*"
},
then in run command 'composer update' after it add dependancy in you app/config/app.php file..
Try:
composer install --no-scripts
this should install all the dependencies without problem
i am just begineer and dont know about symphony.
i have added symfony on my localhost. now i want to integrate it with shopify_api.
i have followed instructions given in github https://github.com/sandeepshetty/shopify_api but as they said
Install Composer:
$ curl -s http://getcomposer.org/installer | php
Run the install command:
$ php composer.phar install
This will download shopify_api into the vendor/sandeepshetty/shopify_api directory.
BUT THERE IS NO FOLDER OF SHOPIFY_API IN MY DIRECTORY STRUCTURE.
and i am not getting any exception in my command prompt.... please tell me the steps how can i integrate with shopify... i want to develop shopify app with symfony framework
I think you forgot to do the first step in shopify doc (adding the shopify bundle to the require).
Please follow all the steps in that documentation.
At the root of symofny project folder , there is a composer.json open it , i added in the below of doctrine
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"sandeepshetty/shopify_api": "dev-master"
},
now run update composer command .
I am trying to execute a migration to rename some columns and I got an exception.
As I read on the documentation I have to add the doctrine/dbal dependency to my composer.json file. How do I do that? Which is the correct composer.json file. I have many in my application. Is the one that is on the same level as the folders app,bootstrap, public and vendor.
If so how do I add that dependency. Do I have to download anything?
By the way im using easyphp, not wamp!
Edit 1
After doing that the console throws this error
1) To install dependency , run this command
composer require doctrine/dbal
2) For 'git' is not recognized error, either you don't have git installed or the PATH is not added in the environment variables.
Install git for windows.
To add this dependency open the composer.json at the root of your project (in the same level as app, public etc.) and in the require section add the doctrine/dbal package like:
"require": {
"laravel/framework": "4.1.*",
"doctrine/dbal": "v2.4.2"
},
Save the file and run composer update
Edit
You probably installed git with the default settings and it's not in your PATH env.
Open Git Bash (it was installed with git - you will find it in your programs) and do composer update. By the way it's far better that windows command prompt.
If you are getting error while running migration try this
composer require doctrine/dbal:2.*
I have installed composer.
My project dir tree looks something like this
/home/myproject/public_html/myproject.com
I initially installed it in:
/home/myproject/public_html/myproject.com/bin/composer/
But later moved it to:
/home/myproject/usr/local/bin/composer
Questions:
Where to I create composer.json ?
In the official docs they mention that in order to install new packages I need to write a require key in the json format in that file, does this mean that I dont have to upload the package through ftp?
The docs further say that I can simply install dependencies like ths:
php composer.phar install
I dont understand the workflow of this process (im fairly new).. what exactly do I need to do to get some packages going (like Respect)
Composer has 2 basic elements for you to consider:
The composer.php file itself - this can be located anywhere on your system - usually it is convenient to have it in you search path so you can invoke it by name (no path) from the command line.
Composer.json - this file is the configuration for your project. This is usually best located at the top level of your project. Ideally this is a directory outside the scope of your web server - so that it will never be exposed or served.
Symfony2 has some great documentation and examples of composer in use.
Also be aware that some packages you reference via composer will themselves have composer files - to ensure they match your required dependancies - and they may also have their own dependancies that need to be considered.
I would install composer.json in the following
/home/myproject/composer.json
It would be out of scope of the web server and could be used to manage many assets e.g.
public_html/
libs/
config/
docs/
vendor/
Where to I create composer.json ?
You should create composer.json to your project root like /home/myproject/public_html/myproject.com/composer.json. If all files of your application live inside your myproject.com folder.
In the official docs they mention that in order to install new
packages I need to write a require key in the json format in that
file, does this mean that I dont have to upload the package through
ftp?
Yes as long as you're not in shared hosting because most of them don't allow CLI (SSH).
The docs further say that I can simply install dependencies like this
php composer.phar install
Yes you can simple type the above command and composer.json will install the latest version of your package.
Composer.json (Respect Package)
{
"require": {
"respect/validation": "dev-master"
}
}
Now run composer install will install the require package.
For further packages
{
"require": {
"respect/validation": "dev-master",
"doctrine/orm": "2.*"
}
}
Now run update composer update it will download the doctrine/orm as well.
I have project on Symfony 2 and i would like use PHPUNIT on Windows 7.
On githut phpunit is:
Composer
Simply add a dependency on phpunit/phpunit to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a development-time dependency on PHPUnit 3.7:
{
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
}
For a system-wide installation via Composer, you can run:
composer global require 'phpunit/phpunit=3.7.*'
Make sure you have ~/.composer/vendor/bin/ in your path.
First i use system-wide installation but i dont know when this installed.
Next i add to my composer.json require-dev.
This installed phpunit in C:/wamp/www/myproject/vendor/symfony. Next i try commands:
composer install --dev
And i can't use phpunit. In cmd.exe i enter "phpunit" and i have error:
'phpunit' is not recognized as an internal or external command operable program or batch file
How can i use phpunit? I have Windows 7, Wamp server and php 5.4.12.
When you install PHP-Unit in windows via composer, the global installation will create files in
C:\Users\YOUR_USERNAME\AppData\Roaming\Composer
To execute phpunit easily via command line you need to add path of phpunit.bat file in windows Environment Variables. For this:
Right click My Computer
Go to Properties -> Advance system settings and
Click Environment variables from the Advance tab.
Now add C:\Users\YOUR_USERNAME\AppData\Roaming\Composer\vendor\bin to the windows PATH.
You can now run the phpunit from command. Note that you may need to restart your command prompt for the changes to take effect.
The bin file of packages are put in the configured bin directory. By default, this is vendor/bin and when you use the symfony standard edition, this is the bin folder.
To execute this bin file, run ./bin/phpunit (or ./vendor/bin/phpunit when not using the Symfony Standard Edition)
Windows users have to put this in double quotes: "bin/phpunit" (or "vendor/bin/phpunit")
composer require --dev phpunit/phpunit ^7
The above example assumes, composer is already on your $PATH variable.
You composer.json should look similar to;
{
"name": "vendor_name/package_name",
"description": "This project is for practicing writing php unit tests",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "Umair Anwar",
"email": "umair.anwar#gmail.com"
}
],
"autoload": {
"classmap": [
"src/"
]
},
"require-dev": {
"phpunit/phpunit": "^7",
"phpunit/dbunit": "^4.0"
}
}
Easiest way to install phpunit via composer is to run from project root.
$ composer require phpunit/phpunit
What this would do is, it will create a phpunit folder inside vendor/bin
and you can run unit tests like this..
$ ./vendor/bin/phpunit
Too simple operation on Windows with composer and works for me following way:
Install composer
https://getcomposer.org/doc/00-intro.md#installation-windows Go to
your symphony folder e.g C:\wamp64\www\symfony\UserManagement where is
composer.json and run this command.
Should be register with global to not have issue $phpunit bash: phpunit: command not found
//old version is 5.7 new 6.4 or put newest version.
composer global require --dev phpunit/phpunit ^5.7
I remember futzing around with the composer dependency stuff for phpunit and never could get it to work.
Instead, from your git bash shell:
mkdir ~/bin
cd ~/bin
curl https://phar.phpunit.de/phpunit.phar > phpunit
chmod +x phpunit
exit out of bash and then start a new bash session.
And you should be good to go. You can echo $PATH to verify you have a path to ~/bin but one seems to added by default.
https://phar.phpunit.de/phpunit.phar
I also came across the same issue and find out the solution by following steps
To run PHPUnit in Windows 7 under WAMP installation
Composer Install
{
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
}
Simply Set Environment Variable
The php unit will be install in a vendor dir in vendor/bin
Path : C:\wamp\www\myproject\vendor\bin;
Open a new Command Prompt
C:\Users\guny >phpunit --version
PHPUnit 3.7.30 by Sebastain Bergmann