I did not use the sudo when installing doctrine in symfony
So this is what i got..
The "https://flex.symfony.com/aliases.json" file could not be downloaded: failed to open stream: Connection refused https://flex.symfony.com/aliases.json could not be fully loaded, package information was loaded from the local cache and may be out of date
to fix that i did this curl -XGET https://flex.symfony.com/aliases.json
and then i installed composer require symfony/orm-pack composer require --dev symfony/maker-bundle
The problem is that it wont add any db config in the env file....
and when i do the composer require doctrine
i get this
Pontuss-MacBook-Air:cauldron_overflow Pontus$ composer require doctrine
Using version ^1.0 for symfony/orm-pack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Nothing to install or update
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Generating autoload files
34 packages you are using are looking for funding.
Use thecomposer fundcommand to find out more!
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install public [OK]
Executing script security-checker security:check [OK]
So why wont it add the correct data to my env files?
Please any advice
When you install a recipe it installs some sample data to your .env.dist file.
This is only for the first run when you install the recipe. After the install you can do what you want and remove that variables and use it from your Docker for example. So perhaps i don't understood your problem because you wrote that you don't want db config in your env file and in the last line you write that it won't add it.
https://symfony.com/doc/current/configuration.html
I know you use flex but there are some good examples how to use and how to do it. Flex should use the DotEnv-Component.
The last thing is your error (https://flex.symfony.com/aliases.json). I think you have firewall that blocks the load of the aliases file. So you have to check that first. That call should work if you run it in your browser or with curl. Otherwise it could give a problem to load all components.
I solved the issue by removing doctrine and reinstall the package :) and now the env file looks like it should :)
I know that this issue has been posted many times, but for me it seems to be a different problem.
Indeed, this error
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\site_web\send_mail.php on line 3
Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\site_web\send_mail.php on line 3
appears at the begining of my code from this line:
require 'vendor/autoload.php';
So, I guess there must be a /vendor/autoload.php file somewhere in my computer (I have installed composer and ran composer require phpmailer/phpmailer).
So, I looked for this file using: dir /s autoload.php in the Windows command line, and found one here: C:\Windows\SysWOW64\vendor\autoload.php,
but for me, syswow64 folder has nothing to see with autoload.php, I don't see what I am missing here.
What you're missing is running composer install, which will import your packages and create the vendor folder, along with the autoload script.
Make sure your relative path is correct. For example the example scripts in PHPMailer are in examples/, below the project root, so the correct relative path to load the composer autoloader from there would be ../vendor/autoload.php.
The autoload.php you found in C:\Windows\SysWOW64\vendor\autoload.php is probably a global composer installation – where you'll usually put things like phpcs, phpunit, phpmd etc.
composer update is not the same thing, and probably not what you want to use. If your code is tested with your current package versions then running update may cause breakages which may require further work and testing, so don't run update unless you have a specific reason to and understand exactly what it means. To clarify further – you should probably only ever run composer update locally, never on your server as it is reasonably likely to break apps in production.
I often see complaints that people can't use composer because they can't run it on their server (e.g. because it's shared and they have no shell access). In that case, you can still use composer: run it locally (an environment that has no such restrictions), and upload the local vendor folder it generates along with all your other PHP scripts.
Running composer update also performs a composer install, and if you do not currently have a vendor folder (normal if you have a fresh checkout of a project), then it will create one, and also overwrite any composer.lock file you already have, updating package versions tagged in it, and this is what is potentially dangerous.
Similarly, if you do not currently have a composer.lock file (e.g. if it was not committed to the project), then composer install also effectively performs a composer update. It's thus vital to understand the difference between the two as they are definitely not interchangeable.
It is also possible to update a single package by naming it, for example:
composer update ramsey/uuid
This will re-resolve the version specified in your composer.json and install it in your vendor folder, and update your composer.lock file to match. This is far less likely to cause problems than a general composer update if you just need a specific update to one package.
It is normal for libraries to not include a composer.lock file of their own; it's up to apps to fix versions, not the libraries they use. As a result, library developers are expected to maintain compatibility with a wider range of host environments than app developers need to. For example, a library might be compatible with Laravel 5, 6, 7, and 8, but an app using it might require Laravel 8 for other reasons.
Composer 2.0 removed any remaining inconsistencies between install and update results; if you're running composer 1.x you should definitely upgrade.
If you get the error also when you run
composer install
Just run this command first
composer dump-autoload
This command will clean up all compiled files and their paths.
#Bashir almost helped me but I needed:
composer update --no-scripts
Apparently this prevents any scripts from being included before executing artisan.
I found the answer here half-way down the page:
https://laracasts.com/discuss/channels/general-discussion/fatal-error-class-illuminatefoundationapplication-not-found-in-pathtoprojectbootstrapappphp-on-line-14?page=0
Proper autoload.php configuration:
A) Quick answer:
Your autoload.php path is wrong. ie. C:\Windows\SysWOW64\vendor\autoload.php
To date: you need to change it to: C:\Users\<Windows User Name>\vendor\autoload.php
B) Steps with example:
We will take facebook/php-graph-sdk as an example; change to Package Name as needed.
Install composer.exe
Open CMD Prompt. + R + type CMD
Run This command: composer require facebook/graph-sdk
Include path in your PHP page: require_once 'C:\Users\<Windows User Name>\vendor\autoload.php';
Define configuration Secrets and Access Token for your package...etc.
Happy codinig.
C) Further details:
Installing composer on windows will set this default path for your pacakges; you can find them there and include the autoloader path:
C:\Users\<Windows User Name>\vendor
For the same question you asked; the answer was this path for WAMP Server 64 BIT for Windows.
Then simply in your PHP Application change this:
require_once __DIR__ . '/vendor/autoload.php';
To:
require_once 'C:\Users\<Windows User Name>\vendor\autoload.php';
Find your windows username under C:\Users\
Before all this, as pointed before in B) , you need to run this command:
composer require <package name>
for facebook php SDK for example:
composer require facebook/graph-sdk
Thank you for asking this question; appreciated as it helped me fix similar issue and ended writing this simple tutorial.
First make sure you have installed the composer.
composer install
If you already have installed then update the composer.
composer update
If you have cloned your project from Github or got it from somewhere else, you will encounter this error. That's because you are missing the vendor folder and other files. The vendor folder contains packages which are dependent to your project. The package dependencies are stored in composer.json file and the folder was excluded while pushing to Github.
Fix this error by simply running:
composer install
Then you will get all the assets needed for your project.
First, review route inside index.php
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
in my case the route did not work, I had to review the directories.
For me
Just run this command first
composer dump-autoload
to add vendor folder.
then run this command
composer update --no-scripts
to update composer.
Create composer.json file with requisite library for ex:
{
"require": {
"mpdf/mpdf": "^6.1"
}
}
Execute the below command where composer.json exists:
composer install
In case of Drupal :
Use the web root folder of drupal to include autoload for ex:
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/vendor/autoload.php';
In case of other systems:
Use the root folder variable or location to include the autoload.php
I had this path in my machine:
C:/xampp5.0/htdocs/project-recordando-symfony/project-recordando-symfony
Then I ran composer install or/and composer update and it returned this error:
ErrorException ZipArchive::extractTo...
That error is because your path is too much long, I changed to:
C:/xampp5.0/htdocs/p-symfony/*
and worked!
run composer update. That's it
I was able to resolve by removing composer and reinstalling the proper way. Here is what I did:
sudo apt remove composer
sudo apt autoclean && sudo apt autoremove
Installed globally with the instructions from: https://getcomposer.org/doc/00-intro.md
Download from: https://getcomposer.org/installer
global install: mv composer.phar /usr/local/bin/composer
(Note: I had to move mine to mv composer.phar /usr/bin/composer)
I was then able to get composer install to work again. Found my answer at the bottom of this issue: https://github.com/composer/composer/issues/5510
In your project folder, the vendor folder is missing so you got this error:
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in
When you download the project through git, the project is downloaded without the vendor folder
You need /vendor because all your packages are there, including all the classes Laravel uses. The vendor directory contains your Composer dependencies.
The solution is simple, Just run this command:
composer update --no-scripts
composer update
composer update --no-scripts It will Skips execution of scripts defined in composer.json file.
composer update It will update your depencencies as they are specified in composer.json file.
With this command, you will re-create the vendor folder in your project and after that your project will start working normally.
This error occurs because of missing some files and the main reason is "Composer"
First Run these commands in CMD
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Then
Create a New project
Example:
D:/Laravel_Projects/New_Project
laravel new New_Project
After that start the server using
php artisan serve
In my case, It was due to the non-fully installation of the project, because I didn't have enough space on my hard disk
There will be a directory called "vendor" that needs to be in your root directory if you have a cloned repository and trying to set up that time this type of error occurring.
".gitingore" file has written code to not include vendor directory on GIT so after cloning GIT your project facing the issue of missing vendor directory.
Once you add vendor directory your project will start working again.
Change the auto_prepend_file property on php.ini
; Automatically add files before PHP document.
;http://php.net/auto-prepend-file
auto_prepend_file =
In linux first add github Personal access tokens
Navigate to GitHub's Personal Access Tokens page.
Hit "Generate new token" button.
Type something meaningful "Note", select "repo" as scope and hit "Generate token" button.
Take a note of the token.
5 type in terminal with you new "personal access token"
export COMPOSER_AUTH='{"github-oauth":{"github.com":"AB8cd4cab23a9d5399934a7d7698d3fa74e9cfAB"}}'
Run in terminal composer install
i'm trying to install the anahkiasen/former package once again but it won't work. The funny thing is, I downloaded it about a weak ago and it was working perfectly. My code if finished and use's this former package. I tried to install a new package a half hour ago and since this the former class isn't found anymore.
Like I mentioned it, it was working perfectly before, but since I did a composer update it doesn't work.
Well I did what they said over here:
https://github.com/formers/former/wiki/Getting-started
first I run this::
composer require anahkiasen/former:4.0.*#dev
then a composer update
after the update I add this in my config/app.php provider section:
Former\FormerServiceProvider::class,
and this in the alias section:
'Former' => 'Former\Facades\Former',
I tried it but it still doesn't work. Just getting
Class 'Former\FormerServiceProvider' not found
as an output
I removed the package I wanted to install before and found another way.. But the problem with the former class is still there.
Thanks for any help!
Terminal outputs:
/var/www/laravel# php composer.phar require anahkiasen/former
gives:
Using version ^4.0 for anahkiasen/former
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
-------- then I added the provider/alias --- after this:
composer update --no-scripts
gives
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
composer dump-autoload
gives of course:
Generating autoload files
/var/www/laravel/logs# php artisan config:publish anahkiasen/former
gives:
PHP Fatal error: Class 'Former\FormerServiceProvider' not found in /var/www/laravel/logs/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Former\FormerServiceProvider' not found
note that I changed the directory in the last command
Let's start from the beginning.
Follow below steps:-
1) Run below command in terminal:-
composer.phar require anahkiasen/former
2) It'll ask you for the version, type dev-master
3) Add Former's service provider to your Laravel application in app/config/app.php. In the providers array add :
'Former\FormerServiceProvider',
Add then alias Former's main class by adding its facade to the aliases array in the same file :
'Former' => 'Former\Facades\Former',
4) run composer update --no-scripts
After that, run composer dump-autoload, and that should work.
If not working then run this command:-
php artisan config:publish anahkiasen/former
Hope it will help you :)
I'm installing Yii2 in the way that shows the Getting Started tutorial:
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
When I try to access localhost/YiiTutorial/basic/web I get this error:
Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: C:\wamp\www\YiiTutorial\basic\vendor\bower/jquery/dist
In the tutorial says that is nothing to edit... it should work right out of the box... what I'm missing?
If I download the package and place it in the same folder, it works perfect, but I want to install it from composer!
Inside vendor/bower folder it's another one called bower-asset.
Copy this folder content (some other folders named bootstrap, jquery, etc...) and move them to vender/bower.
it a recent bug. update your fxp plugin to latest version (1.1.1) and clear composer's cache and try :
composer self-update
composer global update
composer update
Mainly if not issue regarding to vendor installation so please give permission to your /assets and /runtime folers of your projects and try to run again.
In your vendor folder you should rename bower-asset to bower .
OR you can use the following
make sure that you have the following in your composer.json:
composer.json
Other ways
I have encountered this kind of problem lately, the issue is in your composer it missing the asset-plugins which allows managing bower and npm package dependencies through Composer. Just run this command, you only need to run this command once for all. You can read the yii2 docs. Yii2 Installation
composer global require "fxp/composer-asset-plugin:^1.2.0"
So, I installed Laravel on a dev server (php5.5.3, standard installation, mcrypt installed), and I get the following error message:
Fatal error: Class 'Illuminate\Foundation\Application' not found in /[path_to_laravel_app]/bootstrap/start.php on line 14
Quite odd, and I haven't seen a solution to this file, although I've seen plenty of similar errors. Any advice welcome. Thanks!
/bootstrap/start.php is created after composer install by running Laravel's php artisan optimize. I've had a lot of issues on this during upgrades of Laravel, but removing /bootstrap/start.php, composer.lock, and the vendor directory and re-running composer install should fix this issue.
Run this command:
composer update --no-scripts
In my case I have added another required package(Guzzle) in the compser.json file separately(in the last line but it should be after the laravel package line) and updated the compsoser and came across this issue.
I have checked and my vendor/laravel folder has gone. That was preventing me to run any artisian command.
So "--no-scripts" worked for me as it prevents any scripts to be included before executing artisan.
You can use another method in case you are having issues.
Install another raw laravel and copy all the files from the vendor
file to your old repostory.
Change permission of storage and bootstrap folder to 775 or 777.
Delete everything in the session and view folder of storage/framework
Correct the composer.json. This might happen after you have added a new package configuration by dublicating the require tag.
Do not create yet another
require: {
..
}
use the previous defined one.
Then follow the accepted answer to re-install the packages.
Just Run the command
composer install --no-scripts
Or,
composer update --no-scripts
Double check your composer.json file. If you have error on "require": section this error will occur.
Just restore a previous version of composer.json file and run composer update.