Error : Composer require symfony/web-server-bundle - php

I tried to execute a symfony project within a docker container by "php bin/console server:run " but it generate the following error :
"There are no commands defined in the "server" namespace.
You may be looking for a command provided by the "Debug Bundle" which
is currently not installed. Try running "composer require
symfony/debug-bundle --dev". ]"
Then i tried to install this package, but the error persist .
And i tried to install symfony/web-server-bundle package too, but another error display:
"Composer require symfony/web-server-bundle Info from
https://repo.packagist.org: #StandWithUkraine ./composer.json has been
updated Running composer update symfony/web-server-bundle Loading
composer repositories with package information Updating dependencies
Your requirements could not be resolved to an installable set of
packages. Problem 1
- Root composer.json requires symfony/web-server-bundle 6.1.*, found symfony/web-server-bundle[v3.3.0-BETA1, ..., 3.4.x-dev,
v4.0.0-BETA1, ..., 4.4.x-dev] but it does not match the constraint.
Installation failed, reverting ./composer.json and ./composer.lock to
their original content "

The symfony/web-server-bundle is now deprecated.
For a dev environment, you can try installing the Symfony cli https://symfony.com/download. I don't know what docker image you are using, but the doc has instructions for installation on multiple different linux environments.
Then you can use the Symfony local server: https://symfony.com/doc/current/setup/symfony_server.html.
Typically the command to run the server is:
symfony server:start
A side note: when using docker you will also need to expose the port the web server runs the application on if you want to access it.

Related

Laravel command not found. But it is added to my $PATH on Ubuntu

So I know there are alot of simmular issues but none if them are exactly the same,
I want to start my first laravel project but, my terminal tells me command not found,
I installed composer from the website and when I run composer I can see that it works perfectally with no issue, when running composer global require "laravel/installer" I get this in response :
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.2 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
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 autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
This tells me that laravel is indeed installed but has not updates but when I run command laravel the response is laravel: command not found,
I have added composer to my $PATH already.
This is why I am posting this issue because all the posts I find says to add composer to your $PATH but mine is already but its still a issue.
PHP is also installed on my machine
I am running linux Ubuntu 22.04 LTS
I'll write the answer here so you can close the question. As #geertjanknapen said in the comment if you can install your project the run
composer create-project laravel/laravel your-app-name
cd /your-app-name
php artisan serve
You must have a local server running also, once you have run php artisan serve then just go to http://127.0.0.1:8000/ and you'll see Laravel's home screen. (NOTE 8000 is the default port, so put yours there if you've changed it).

Composer require gives errors while installing barryvdh/laravel-dompdf

I'm quite new with Laravel and wrote my first app.
I'm using Laravel 5.4 with PHP 7.1.5 on Windows, but when I run the composer require barryvdh/laravel-dompdf command, I get following issues. I have followed many "possible solutions" but still it is not working.
This is the error:
Your requirements could not be resolved to an installable set of
packages.
Problem 1
- Installation request for barryvdh/laravel-dompdf ^0.8.1 -> satisfiable by barryvdh/laravel-dom
pdf[v0.8.1].
- barryvdh/laravel-dompdf v0.8.1 requires dompdf/dompdf ^0.8 -> satisfiable by dompdf/dompdf[v0.
8.0, v0.8.1, v0.8.2] but these conflict with your requirements or minimum-stability.
Don't composer update. If you have dompdf/dompdf in your composer.json just update it, specifying 0.8.* as version and running
composer update dompdf/dompdf
then
composer require barryvdh/laravel-dompdf
--
Running a generic composer update will affect all your other dependencies you may want keep as they currently are.
All the changes affected by your composer update command are then recorded in your composer.lock file.
When you'll move your project somewhere else or you'll deploy it on a server for example, the composer install command will read the composer.lock file and will install the exact version of your dependencies which are recorded in it. So you'll be sure about the version of your dependencies.
Run this command
composer require barryvdh/laravel-dompdf "^0.8.2" .
Delete your composer.lock file and run:
composer install
Check then dompdf/dompdf may updated e.g. 0.7.* or ~0.7.0
composer update;
composer require barryvdh/laravel-dompdf;

Composer installation order

Is it possible to set the installation order?
Currently I'm using Doctrine module that requires ext-mongo to be installed, but as I'm using the newer php version (7.0) I have mongodb installed instead. There's a alcaeus/mongo-php-adapter package that resolves installation problems. But there's one problem - Composer is trying to install Doctrine modules first, so that installation fails.
Currently I have to resolve this problem manually, but I can't do it any more as I'm going to pack my environment to a Docker image to let it be automatically deployed later.
From the docs of alcaeus/mongo-php-adapter
"
$ composer require alcaeus/mongo-php-adapter
If your project already has a dependency on ext-mongo, the command above may not work. This is due to a bug in composer, see https://github.com/composer/composer/issues/5030
To fix this, you can use the --ignore-platform-reqs switch when running the above command, or when running composer update with no composer.lock file present."

Setting up php-casperjs with composer

I'm having trouble setting up php-casperjs for my project. I've never used composer before, so I'm not exactly sure what I'm doing wrong.
I got xampp installed on Windows with php version 5.6.12
Here are the steps I completed so far.
Downloaded and installed composer. It launches successfully from the command prompt.
Downloaded php-casperjs and extracted composer.json and src/Casper.php into my project folder C:\xampp\htdocs\test
Navigated to the project folder in the command prompt and ran composer install command which installed 22 packages
Then I ran composer require phpcasperjs/phpcasperjs command and here I ran into problems. I get the following error message
Using version ^1.2 for phpcasperjs/phpcasperjs
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package phpcasperjs/phpcasperjs No version set (parsed as 1.0.0) is satisfiable by phpcasperjs/phpcasperjs[No version
set (parsed as 1.0.0)] but these conflict with your requirements or
minimum-stability.
Installation failed, reverting ./composer.json to its original
content.
When I run the following php code
use Browser\Casper;
$casper = new Casper();
I get Fatal error: Class 'Browser\Casper' not found in C:\xampp\htdocs\test\test.php on line 3
Step1: Go to you project directory and create a file "composer.json"
codes for composer.json
{
"require": {
"monolog/monolog": "1.0.*"
}
}
Note: You can create you composer.json with your required packages but i just created a simple composer.json file with monolog/monolog package. For your understanding you can follow my steps (this). You can remove the package monolog later on.
Now navigate to the project directory where composer.json file located
Run the following command:
composer require phpcasperjs/phpcasperjs
And you faced the above problem because of wrong or mismatched version of the intended package. Keep in mind that you always can create composer.json with your custom packages and their versions and which will be your package manager. For more detail about composer please visit Link

PHP Composer issue (Technic Solder API Setup)

I am in the process of setting up a webserver on Ubuntu 14.04 LTS, and have got my LEMP stack setup properly, as well as installed composer without issue.
When I try to configure composer for use with the solder package via the following command:
$composer require solder/solder
it spits out the following error:
Using version v0.7.3.1 for solder/solder
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for solder/solder v0.7.3.1 -> satisfiable by solder/solder[v0.7.3.1].
- solder/solder v0.7.3.1 requires composer/composer 1.0.0-alpha9 -> satisfiable by composer/composer[1.0.0-alpha9] but these conflict with your requirements or minimum-stability.
Installation failed, deleting ./composer.json.
I even tried running it in sudo mode, same issue (yes, I know your not supposed to run composer commands in sudo or root level access mode, but I tried it just to rule it out as the issue)
Any idea what is causing this, and how to fix it?
The solder/solder package requires the composer/composer package explicitly in version 1.0.0-alpha9. Composer however (ignore the confusing fact that you're using Composer to install Composer for a moment), will not install "unstable" software (i.e. alpha, beta or dev versions) by default.
You can circumvent this by setting the minimum-stability setting in your composer.json file. For this, create the composer.json file by hand:
{
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"solder/solder": "0.7.3.1"
}
}
Followed by running composer install on the command-line.
In comparison, the composer require command that you're using does nothing else that adding the solder/solder key/value pair to the composer.json's require section (also implicitly creating the file, but without the minimum-stability setting) and running an implicit composer install.

Categories