How to configure the Laravel built-in web server? - laravel

I am running this command:
C:\xampp\htdocs\notebook>php artisan serve
However I get this error:
Warning: require(C:\xampp\htdocs\notebook\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\notebook\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\notebook\bootstrap/../vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\notebook\bootstrap\autoload.php on line 17

After creating a project or cloning existing one you should run composer install command which will install all dependecies and will create autoload.php file.

That is an import error.
Everytime you have one of these, you should try to run composer dump-autoload.
Most of the time, this command will fix your imports.

It looks like you might not have installed the required dependencies yet. You should do so using the composer package manager, like so:
C:\ProgramData\ComposerSetup\bin\composer install

Related

Why do I have to "composer install" whenever I switch to a branch? Does it kill my memory?

Context: I am roughly new to Laravel and Github. I am working on a project with 3 other people, and we have created all our individual branches. But every time, I switch to their branch (which I am to successfully) but whenever I am trying to run the server on port 8000 I get the following error:
C:\Users\Einstein\Documents\Program\Project>php artisan serve
PHP Warning: require(C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\Einstein\Documents\Program\laravel\Project\artisan on line 18
Warning: require(C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\Einstein\Documents\Program\laravel\Project\artisan on line 18
PHP Fatal error: require(): Failed opening required 'C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\Einstein\Documents\Program\laravel\Project\artisan on line 18
Fatal error: require(): Failed opening required 'C:\Users\Einstein\Documents\Program\laravel\Project/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users...8```
However, I am to run the project whenever I perform composer install. Why is that so? It seems like I have to rerun the packages whenever I am switches to branches, does it kill my computer memory? If I have to reinstall packages (this is my assumption whenever I perform composer install) will kill my computer memory.
Thanks.
It is most likely because you are pulling in cached files calling the other peoples local paths and not yours. When you run composer install it pulls all the dependencies listed in the composer.json file to the /vendor folder, then rebuilds the config cache.
You can try and just rebuild the cache instead of re-installing all the dependencies with:
composer dump-autoload and php artisan clear:cache

Composer fails [UnexpectedValueException]

After installing a new version of a Magento 2 module composer fails on every command. Also the backend of Magento isn't working anymore:
1 exception(s):
Exception #0 (UnexpectedValueException): Package magento/composer's
source key should be specified as {"type": ..., "url": ...,
"reference": ...},
{"type":"git","url":"https:\/\/github.com\/magento\/composer.git","reference":null} given.
Also when using composer -v command via ssh the same error is showing.
When trying to flush the cache via ssh the same error is showing and also an extra error:
Fatal error: Uncaught Error: Class 'Cli' not found in
Does anyone know how to fix this?
Few things you can try:
Try to reinstall composer.
Also you can try running composer clear-cache. Also check for any running composer process and kill then first.
If this is still an issue anyone has I found through much digging that reference cannot be set to null. If a download from source is necessary than I recommend moving up a directory for your url or use a dist instead of source

( ! ) Fatal error: Class 'Route' not found in C:\wamp\www\untitled1\routes\api.php on line 16

i get this error when i'm using laravel with phpstorm ,wamp server
enter image description here
could you please help me ,thank you
It seems that you have not installed the composer file dependencies. Try to do a composer install
On your project directory where the composer.json file should exist.
If you haven't already installed composer, follow the instructions at composer site.

laravel 4 install issue when using composer install

When I run
composer.phar install
I get this error almost at the end of the installation, any ideas?
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/belendez/public_html/laravel/artisan on line 46
Parse error: syntax error, unexpected T_STRING in /home/belendez/public_html/laravel/artisan on line 46
Script php artisan optimize handling the post-install-cmd event returned with an error
I look into the suggested link and it appears that somehow in the middle of the installation it changes from 5.3 to 5.2! If I try to start installation using 5.2 it returns right a way: class 'Phar' not found. Any ideas?
It seems that issuing only a php command will pick up another version of the interpreter. Try to change all the references to php in your composer.phar file to the one you want actually to be executed (in your case it seems /opt/php53/bin/php).
You can confirm that by simply launching a php -v directly from the command line to see what version your server will pick up

unable to run laravel 4

I thought it was about time to look at a PHP Framework so I chose laravel. However, getting it running is causing me grief.
I followed the video from nettuts installing laravel 4 and at 5.05mins into the video he uses the php command-line server command (available from 5.4) php -S localhost:8888 -t public/ followed by confirming that it works via localhost:8888 in the browser which displays 'Hello Wolrd!'
I have XAMPP installed and my version of PHP is 5.3.15. I attempted to test it by doing http://localhost/learning-laravel/public/
At this point I have already downloaded composer and installed the dependancies successfully.
But I keep getting the following error:
Warning: require(/Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/../vendor/autoload.php) [function.require]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/autoload.php on line 17
Fatal error: require() [function.require]: Failed opening required '/Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/autoload.php on line 17
Inside my learning-laravel folder I do have bootstap/autoload.php
Can someone please help? Thanks.
I had another look at my folder structure and I noticed that composer had not run correctly and there were missing files. I've reinstalled it and it appears to be working.

Resources