Where is the Vendor module in YII Initializr? - php

I have installed YII Initializr module and YII framework is in my PHP Include path.
But as soon as I run mysite/frontend/www/index.php,
I get this error:
Warning: require(./../../common/lib/vendor/autoload.php): failed to open stream: No such file or directory in D:\xampp\htdocs\yiiinit\frontend\www\index.php on line 12
Fatal error: require(): Failed opening required './../../common/lib/vendor/autoload.php' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\yiiinit\frontend\www\index.php on line 12
Please help.

Here are the steps to generate vendor autoload.php file.
Step 1. Create account on https://github.com and go into setting => Personal access tokens i.e. https://github.com/settings/tokens
Step 2. Generate github access token.
Step 3. Now open command prompt (cmd) and go into the folder where yii installed and run command => composer update (Note:- there should be a composer.json file).
Step 4. cmd require Token form your side now copy token generated in step 2 and paste it in cmd.
Step 5. Yii2 Frameworke installed successfully now browse web/index.php

Missing /vendor/autoload.php file is generated automatically by composer after package installation.
You must first install composer (sell documentation). Then run
php composer.phar install
or if installed globally
composer install
in the directory where composer.json file is located

With experience it seems that composer does not download the vendor folder with a slow internet connection. If composer returns any error when installing the basic application try downloading it manually and then work from there possibly composer failed to generate the folder.
Here is a link to the basic yii2 app: https://github.com/yiisoft/yii2/releases/download/2.0.11/yii-basic-app-2.0.11.tgz

1 Create/Sign in into github account.
2 Go to Profile>>Settings>>Personal access tokens (OR) click on this https://github.com/settings/tokens.
3 Click on Generate new token
4 Select the appropriate scopes and click Generate token.
5 Copy the the token Key and past it in composer when the composer want you the Token(like: Token (Hidden):)
Now it will enter into the installation process.

if you are using composer,
install mbstring for your PHP version and run composer install again

Related

Why I can't find vendor/autoload.php for Google Calendar API?

I am following all steps to run a PHP Google Calendar Api. I followed this link: https://developers.google.com/google-apps/calendar/quickstart/php . In step 4 it asks to run quickstart.php, but as after running the file, it displayed me this error :
Warning: require(vendor/autoload.php): failed to open stream: No such
file or directory in
C:\xampp\htdocs\Calendar\google-api-php-client-master\quickstart.php
on line 2
Fatal error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\Calendar\google-api-php-client-master\quickstart.php
on line 2
Here's a check-list for you to go down with Composer and vendor/autoload.php:
Does your composer.json file exist in the root of your project? (Note: This may be up a level from your document root for your web server.)
Does the vendor folder exist in the same folder as your composer.json?
Are you using the correct relative path to find your vendor/autoload.php file?
If composer.json isn't in your project root, move it there. It's where it belongs and things will continue to go wrong for you until it's there.
The vendor folder and its autoload.php file are both automatically created when you run php composer.phar install or php composer.phar update. If they're missing, you need to run php composer.phar install.
Once you've verified that vendor/autoload.php exists and is in the correct location, make sure that you have a good relative reference to that file with your require statement.
I solve this issue using the followed command:
composer dump-autoload -o
I would execute it inside of the application folder.
Example:
c:\<< your_app_folder >>\composer dump-autoload -o.
After that, you will see the "vendor" folder. The autoload.php file will inside.
For more information, access the link:
http://phpenthusiast.com/blog/how-to-autoload-with-composer
This fixed it for me
make sure you have composer installed then try the below command in your terminal
composer update

Failure to find autoload.php

I'm stuck on a very basic problem:
I'm trying to use Laravel, which I installed on my windows 7 with composer.
When I try to access my website locally with Wamp, I get the error:
Warning:
require(C:\wamp\www\sitedirectory\public\protected\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\wamp\www\sitedirectory\public\protected\bootstrap\autoload.php on
line 17
Everywhere I can read that all I have to do is run composer install or update.
The problem is that I did run both and nothing has to be updated.
The files are where they are needed so I dont understand what could be the problem.
Does anyone have an idea of what could be my problem?
Thank you in advance.
Composer is a tool for managing and installing dependencies.
There should exist a file named composer.phar in the directory C:\wamp\www\sitedirectory\public\protected\. There you should execute the command composer.phar install (on the command line).
Then, the directory vendor containing the autoload.php etc. should be generated.
If the composer.phar does not exist (but at least a file named composer.json), follow the steps explained here to download composer.

Google plus login functionality and composer library install

I am working on Google + login functionality for that purpose I am referring https://developers.google.com/+/quickstart/php url. I have done all the suggested instructions
Enabled google plus api
Set up the PHP quick-start app
In second step to run signin.php file they are suggesting to Install composer and run command php composer.phar install.
I have already installed Composer on my machine and it is up to date.
I am not getting how to run php composer.phar install command as the code cloned from https://github.com/googleplus/gplus-quickstart-php.git does not have composer.phar file (only have composer.json and composer.lock files)
How do I install these dependencies as when I run signin.php file
Fatal error appears as autoloader.php not found.
I am guessing that by using composer I need to download directory from https://github.com/google/google-api-php-client.git as this is written in composer.json file.
Let me know what should I do?

Getting [ErrorException] - installing yii2 using composer

I am trying to install Yii2 on WAMP using composer.
c:\Users\username>php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.0
I am getting the following error when I run the command which is given above.
[ErrorException]
Argument 1 passed to Fxp\Composer\AssetPlugin\Repository\BowerRepository::createVcsRepositoryConfig() must be of the type array, null given, called in C:\Users\username\AppData\Roaming\Composer\vendor\fxp\composer-asset-plugin\Repository\AbstractAssetsRepository.php on line 136 and defined
Can someone help solving this error? But, it is created a folder named "basic".
I have copied this folder to D:\wamp\www and when I access localhost/basic/web/ from browser, I am getting the following error.
ReflectionException
Class yii\debug\Module does not exist
I am following the instructions to install yii2 from http://www.yiiframework.com/download/
Please assist me to resolve these issues.
Thanks
First windows does not have a curl processor like unix so you need to use the other option for installing Composer
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
For this to work you need the php.exe processor to be on your path, so you have 2 options here. Either add the c:\wamp\bin\php\phpx.y.z folder to your PATH or my prefered option write yourself a little .cmd file which will do it for you like this
addphp.cmd
PATH=%PATH%;c:\wamp\bin\php\phpx.y.z
Put this file in a folder already registered on your path so you can run it from anywhere in a command window.
Now you will have to edit the \wamp\bin\php\phpx.y.z\php.ini file. This is similiar to the one used by php code run through the Apache web server but is only used by the PHP CLI (Command Line Interpreter)
Make sure the extension php_curl is uncommented or the above line wont work i.e. remove the ; comment symbol
extension=php_curl.dll
So now run a command window, cd into the folder that you want composer installed into and run the command above, then follow the rest of the install instructions on Install instructions
EDIT: Thank you for reminding me.
This error happens because of invalid json on plugin you or application requested (npm or bower).
The link here suggests you to run:
composer global update.
This will update composer cache. Hope it helps.

My Laravel installation error on localhost

I am new to Laravel, I have installed the Laravel on my localhost using
WAMP server but I am getting an error after all steps.
The errors are:
( ! ) Warning: require(C:\wamp\www\laravel/../bootstrap/autoload.php): failed to open stream: No such file or directory in C:\wamp\www\laravel\index.php on line 21
( ! ) Fatal error: require(): Failed opening required 'C:\wamp\www\laravel/../bootstrap/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\laravel\index.php on line 21
I have used below link for Laravel installation
http://www.wikihow.com/Install-Laravel-Framework-in-Windows
I have tried to debug the issue but haven't found success in the installation.
Please let me know what is missing in installation.
You need to install Composer, open up the command prompt and cd to your directory (or hold Shift while right-clicking on your directory and clicking Open command window here) and there run composer install.
You can simplify the Laravel installation with Composers create-project command.
composer create-project laravel/laravel path
Laravel dependencies are not installed yet. That is why it is giving you this error.
https://getcomposer.org/download/
Go to this link and download composer if you haven't already.
Move the composer file to /usr/bin and rename it to just composer.
Go into the root directory of your laravel application. And run:
composer update
This will install and update all required dependencies.
In case you are on windows, which is less likely, but if you are, just download and install composer via the installer and issue the same command in you project's root directory.
Composer is PHP's dependency manager.
In the root directory of your laravel installation you will find a composer.json file. It contains the list of all your project's dependencies. If you ever need to install a package in your project, it becomes very easy. You just have to edit the composer.json file and let it know which package you need. Issuing composer update will install new package listings and update all existing ones.
just to be clear I'm not big fan of wamp.
I've just took quick look at the
http://www.wikihow.com/Install-Laravel-Framework-in-Windows
and I suppose laravel framework is not going to work best with point 11 to 14 modifications.
Baseline for laravel to work is you need to http serve /public folder in a properly configured environment (after composer install and create-project as described earlier).
If you want to take full advantage of laravel you need to often cli `php or composer (at least)` efficiently.
While using laravel I suggest installing PHP and MYSQL yourself from scratch (it really takes few minutes) and using convenient IDE (like PHPSTORM for example).
Nowadays PHP has builtin http server, so you don't need any http server in your dev environment.
So in Windows:
Install PHP and enable required libraries in php.ini
Install and configure local mysql server (easiest way installing via MySQL installer)
Start development server by invoking php.exe -S localhost:80 -t "absolute-path-to-your-laravel-installation\public" like for example C:\htdocs\laravel\public via commandLine
Enter url in your favorite browser http://localhost
Hope that will help to get you started.

Categories