Symfony and doctrine issues - php

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 :)

Related

Symfony/flex problem installing stof_doctrine_extensions

I'm trying to use slugs for my symfony project. The first thing that I wanted to do is to install StofDoctrineExtensionsBundle. I tried to follow the tutorial in symfony website
https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
The result of the command : composer require stof/doctrine-extensions-bundle is
Using version ^1.6 for stof/doctrine-extensions-bundle
./composer.json has been updated
Running composer update stof/doctrine-extensions-bundle
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
52 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [OK]
Executing script assets:install public [OK]
Nothing to unpack
It seemed ok for me but a file called "stof_doctrine_extensions.yaml" should ve been generated and was not created automatically. For now I tried to create manually the file I honestly don't know if it's a good move here's what my file looks like
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
sluggable: true
I still didn't figure it out the error now is :
/stof_doctrine_extensions.yaml"). Looked for namespace "stof_doctrine_extensions", found ""framework", "maker", "twig", "doctrine", "doctrine_migrations", "web_server"" in /config/packages/stof_doctrine_extensions.yaml (which is being imported from "/src/Kernel.php").
If anyone could help I would be really grateful

"vendor" folder missing after running "Composer Install"

I am currently trying to run on Vagrant/Homestead a Laravel Application that I pulled from Github. I connected it to the database, and run Composer Install, Composer Update inside the folder. When I try to access to it on the Browser I get the following error:
Warning: require(/home/vagrant/.../public/vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/..../public/autoload.php on line 2
I navigated to the vendor folder and noticed that it was not created. Any ideas how to fix it?
The application runs in Laravel 4, and I got the following output from the terminal when I run Composer Install:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Package mjolnic/bootstrap-colorpicker is abandoned, you should avoid using it. Use itsjavi/bootstrap-colorpicker instead.
Generating autoload files
php artisan clear-compiled
php artisan optimize
Generating optimized class loader
Any ideas?
Composer needs to be run from the root of your application, i.e. not from the public folder as your error seems to indicate.
You can first try running:
composer install --no-scripts
This command should list the packages that are being downloaded and installed. If the above works, you can then run:
php artisan optimize
This will create the autoload.php file that Laravel will use.
I also experienced that, i solved the problem by creating a vendor/bin folder inside the Composer directory.
$PATH/users/*-system_name-*/AppData/Roaming/Composer
I got the same problem, some answer are valid but didnt help then i tried a command = composer dump-autoload. Then it works fine. HOPE this helps you the best.

Unable to install any package by composer in YII2

I am trying to install package library by composer in YII2. But after running the command from my command prompt I am getting following error
My composer command is
composer.phar require kartik-v/yii2-widget-datetimepicker "*"
Package yiisoft/yii2-codeception is abandoned, you should avoid using it. Use codeception/codeception instead.
When installing by this command
php composer.phar require kartik-v/yii2-social "#dev"
Then I am getting following error
Package facebook/php-sdk-v4 is abandoned, you should avoid using it. Use facebook/graph-sdk instead.
Generating autoload files
Please suggest me how can I resolve this error
This is not an error. This is just an information for you from composer that one of the required packages has been abandoned and you should not expect to get updates for it.
If you want to get rid of this information simply remove the mentioned packages from the composer.json file of your project.
If the package is not listed there it means that one of the required packages listed needs it as dependency so you can not remove it directly.
As for the Yii 2 - here is the current advanced project template's composer.json so you can update the one in your project - package yiisoft/yii2-codeception is no longer used.

class 'Former\FormerServiceProvider' not found - Laravel

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 :)

Symfony 2.1 doctrine fixtures installation

I am using latest symfony 2.1 and trying to install the doctrine fixture bundle.
I followed the instructions listed here.
Install composer and git as well. But now when I am trying to update the vendor libraries (php composer.phar update) I am getting the following error:
Loading composer repositories with package information
Updating dependencies
- Removing doctrine/dbal (2.3.0)
vendor\doctrine\dbal\lib\Doctrine - The directory is not empty.
[RuntimeException]
Could not completely delete vendor/doctrine/dbal,
aborting.
How can I solve this issue?
This occurs when a package directory in the vendor dir is locked for some reason by another application. This tends to happen on windows where many things can lock a directory/file.
If it's an intermittent issue, running composer update should fix it, but if it persists try to remove vendor\doctrine\dbal\lib\Doctrine by hand.
If it is really locked you won't be able to delete it either unless you close anything locking that dir. Using Unlocker can assist you if you have no idea what is holding a lock over the directory.

Categories