Setting up php-casperjs with composer - php

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

Related

Error : Composer require symfony/web-server-bundle

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.

Failed while installing a package using composer

iam tryin to use a cart package by using this command
composer require jason-napolitano/codeigniter4-cart-module
and it's failed. this is what it said
Using version dev-master for jason-napolitano/codeigniter4-cart-module
./composer.json has been updated
Running composer update jason-napolitano/codeigniter4-cart-module
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 jason-napolitano/codeigniter4-cart-module dev-master -> satisfiable by jason-napolitano/codeigniter4-cart-module[dev-master].
- jason-napolitano/codeigniter4-cart-module dev-master requires codeigniter4/framework ^4.0.3 -> satisfiable by codeigniter4/framework[v4.0.3, ..., v4.1.1] from composer repo (https://repo.packagist.org) but codeigniter4/framework[1.0.0+no-version-set] from root package repo has higher repository priority. The
packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
is it because my minimum-stability in composer.json is set to "stable"?
I presume you created your project by using composer create-project codeigniter4/framework. This effectively created a clean project for you without the .git folder, thus removing any metadata on what version of codeigniter4/framework package you installed. This is indicative by 1.0.0+no-version-set part of the error message.
The jason-napolitano/codeigniter4-cart-module package requires ^4.0.3 version of codeigniter4/framework, but since you have no version metadata in your project, install fails. This can be resolved by setting the version from which you bootstrapped your project manually in your root composer.json:
{
"name": "codeigniter4/framework",
"version": "4.0.3",
...
}
However, this is just a guess, since I have no insight into your main composer.json.
Your PHP is missing intl extension. It is useful for formatting currency, number and date/time as well as UCA-conformant collations, for message formatting and normalizing text..etc.
Check out Codeignitor 4 [Documentation][1]:
Follow the steps to install it in XAMPP -
Open [xampp_folder_path]/php/php.ini to edit.
Search for ;extension=intl and remove the ;.
Save the php.ini file and restart Apache.

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 uses old package version

I have a custom package injected into my project via composer.json, this package is currently on version 2.0.1
I changed something in the source code of the package and set the version in the package.json to 2.0.2 pushed it to git and tried to update my composer but every time I get
- Installing myproject/laravel-jssettings (v2.0.1): Cloning 9663e29ee0 from cache
even tho I cleared the composer cache and deleted the composer.lock file
The line in my composer.json file is
"myproject/laravel-jssettings": "~2.0",
I tried to set it to
"myproject/laravel-jssettings": "2.0.2",
but then i get an error message which says
Problem 1
- The requested package myproject/laravel-jssettings 2.0.2 exists as myproject/laravel-jssettings[v2.0.0, v2.0.1] but these are rejected by your constraint.
what do i miss here, where do i have to clear the cache or change to a new version so that the composer gets the new 2.0.2 version. thx in advance
You need to craete a tag for your custom repository. After that tag will be pushed to repositroy composer will get lates updates.
git tag 2.0.2
git push origin --tags
and after that try to composer update on your project. Composer documentation

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