cant install cakephp 4 again - php

I have wamp64, php 7.4 and using composer I ran this from the console
composer create-project --prefer-dist "cakephp/app:^4.0" myapp
and
composer create-project --prefer-dist cakephp/app:~4.0 my_app_name
The installation cut out towards the end with this error
Script App\Console\Installer::postInstall handing the post create project cmd event terminated with an exception
[Symfony\Component\Console\Exception\RunTimeException\ Aborted
and some Symfony runtime exception when you get to the set folder permission y/n
It created this JSON file
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "https://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=7.2",
"cakephp/cakephp": "~4.2.0",
"cakephp/migrations": "^3.0",
"cakephp/plugin-installer": "^1.3",
"mobiledetect/mobiledetectlib": "^2.8"
},
"require-dev": {
"cakephp/bake": "^2.3",
"cakephp/cakephp-codesniffer": "~4.2.0",
"cakephp/debug_kit": "^4.4",
"josegonzalez/dotenv": "^3.2",
"phpunit/phpunit": "~8.5.0 || ^9.3",
"psy/psysh": "#stable"
},
"suggest": {
"markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
"dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan/Psalm compatibility.",
"phpstan/phpstan": "PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code."
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests/",
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"check": [
"#test",
"#cs-check"
],
"cs-check": "phpcs --colors -p src/ tests/",
"cs-fix": "phpcbf --colors -p src/ tests/",
"stan": "phpstan analyse",
"test": "phpunit --colors=always"
},
"prefer-stable": true,
"config": {
"sort-packages": true
}
}
How to Fix Cakephp 4 Composer Install Error
(i didnt understand the solution to this)
Cakephp 4 Windows Installation Issues

It should be possible to get it to work. What Windows version do you use? Pro or Home? Which distribution? 2010?
Please make sure to navigate to the WAMP install folder and then specifically the www folder.
The command I use is this;
composer create-project --prefer-dist cakephp/app:~4.0 cake
It worked for me.
Alternatively, download Cakephp version 4.0, place the contents in the www folder, and configure it manually through the file /config/app.php. If you want, we can look at it together. There are not many people around me that can or want to work on Cakephp, so it'd be a pleasure. :)

Related

Magento 2 website with multiple errors (HTTP Error 500, PHP Warning, among others) can't make it work again

we currently have a locally hosted Magento test site and some time ago it was working OK but after doing some changes it stopped working and constantly shows HTTP Error 500. I am new to Magento and to Linux (we use here a Gentoo Linux machine) and I tried to research as much as I can, testing different solutions, but the problem persists and I have the idea that is getting worse every time I try to resolve something.
The problem I am having now inside the Terminal is a PHP Warning and PHP Fatal Error related to the 'require' function. Every time I try to do something about Magento I have this error (for example, if I run 'php bin/magento --version' I have this error, and so on with every command related with Magento). As far as I understand, this problem occurs when you try to call for a file that doesn't exists or is not there. In my case trouble seems to be related with the Sage Pay extension. This is the warning I have inside Terminal:
PHP Warning: require(/var/www/localhost/htdocs/vendor/composer/../ebizmarts/sagepaysuite/registration.php): failed to open stream: No such file or directory in /var/www/localhost/htdocs/vendor/composer/autoload_real.php on line 73
PHP Fatal error: require(): Failed opening required '/var/www/localhost/htdocs/vendor/composer/../ebizmarts/sagepaysuite/registration.php' (include_path='/var/www/localhost/htdocs/vendor/magento/zendframework1/library:.:/usr/share/php7:/usr/share/php') in /var/www/localhost/htdocs/vendor/composer/autoload_real.php on line 73
Thinking that this could be related to the extension itself being missing for some reason, when I try to install the extension I have this error:
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Failed to execute git clone --no-checkout -- 'https://MHuYqyU63hS4dojaex1J:
***#gitlab.ebizmarts.com/ebizmarts/magento2-sage-pay-suite.git' '/var/www/l
ocalhost/htdocs/vendor/ebizmarts/sagepaysuite' && cd '/var/www/localhost/ht
docs/vendor/ebizmarts/sagepaysuite' && git remote add composer -- 'https://
MHuYqyU63hS4dojaex1J:***#gitlab.ebizmarts.com/ebizmarts/magento2-sage-pay-s
uite.git' && git fetch composer && git remote set-url origin -- 'https://gi
tlab.ebizmarts.com/ebizmarts/magento2-sage-pay-suite.git' && git remote set
-url composer -- 'https://gitlab.ebizmarts.com/ebizmarts/magento2-sage-pay-
suite.git'
Cloning into '/var/www/localhost/htdocs/vendor/ebizmarts/sagepaysuite'...
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.ebizmarts.com/ebizmarts/ma
gento2-sage-pay-suite.git/'
Similarly, when I try to update Composer I have the same error related to Sage Pay and the update is aborted.
Our current composer.json file is as follows:
{
"name": "magento/project-community-edition",
"description": "eCommerce Platform for Growth (Community Edition)",
"type": "project",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"config": {
"preferred-install": "dist",
"sort-packages": true
},
"require": {
"absolute_design/absolute-slider": "^2.0.0",
"bitware/speedenginedeferjs": "^1.0",
"ebizmarts/sagepaysuite": "~1.3",
"magefan/module-wysiwyg-advanced": "^2.0",
"magento/data-migration-tool": "~2.3",
"magento/product-community-edition": "~2.3.7-p1",
"mageplaza/magento-2-english-united-kingdom-language-pack": "dev-master",
"mageplaza/magento-2-seo-extension": "^2.1",
"mageplaza/module-ajax-layered-navigation": "^1.0",
"mageplaza/module-delete-orders": "^1.2",
"mageplaza/module-gdpr": "^1.2",
"mageplaza/module-sitemap": "^1.0",
"olegkoval/magento2-regenerate-url-rewrites": "^1.5",
"trustpilot/module-reviews": "^2.6"
},
"require-dev": {
"allure-framework/allure-phpunit": "~1.2.0",
"friendsofphp/php-cs-fixer": "~2.14.0",
"lusitanian/oauth": "~0.8.10",
"magento/magento-coding-standard": "~3.0.0",
"magento/magento2-functional-testing-framework": "2.4.5",
"pdepend/pdepend": "2.5.2",
"phpmd/phpmd": "#stable",
"phpunit/phpunit": "~6.5.0",
"sebastian/phpcpd": "~3.0.0",
"squizlabs/php_codesniffer": "~3.4.0"
},
"conflict": {
"gene/bluefoot": "*"
},
"autoload": {
"psr-4": {
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
"Magento\\Setup\\": "setup/src/Magento/Setup/",
"Magento\\": "app/code/Magento/",
"Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
},
"psr-0": {
"": [
"app/code/",
"generated/code/"
]
},
"files": [
"app/etc/NonComposerComponentRegistration.php"
],
"exclude-from-classmap": [
"**/dev/**",
"**/update/**",
"**/Test/**"
]
},
"autoload-dev": {
"psr-4": {
"Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
"Magento\\Tools\\": "dev/tools/Magento/Tools/",
"Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
"Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
}
},
"version": "2.3.0",
"minimum-stability": "stable",
"repositories": {
"0": {
"type": "composer",
"url": "https://repo.magento.com/"
},
"magento": {
"type": "composer",
"url": "https://repo.magento.com"
},
"ebizmarts": {
"type": "composer",
"url": "https://packages.ebizmarts.com"
}
},
"extra": {
"magento-force": "override"
}
}
Any help would be appreciated, I am very lost and stuck right now not knowing how to resolve this.
Thanks in advance.
Maybe issue from extension ebizmarts/sagepaysuite
you can check file composer.json in this extension. In file composer.json you can see lable "require" php version for this extension.
=> you can delete this extension or upgrade you php version.
have a nice day !

Composer doesn't autoload custom package

acknowledgement:
First of all this is my first post for help, as i went trough a lot of articles on stackoverflow and other resources and just could not find solution.
Problem sounds familiar but i just can't figure it out, maybe because im stuck on it for 2 days now. Another note, this is my first package so yes im not 100% sure what im doing.
Structure:
- laravel-project
- ...
- packages
- my-custom-package
- src
- MyCustomPackageServiceProvider.php
- composer.json
- public
- resources
- routes
- ...
- composer.json
So it is basic Laravel 5.8 + inside added package folder for local package devolment (it has been moved to repo as well)
Current Code (simplified as its actual work project):
File: laravel-project/packages/my-custom-package/composer.json
{
"name": "company/my-custom-package",
"type": "library",
"require": {
"php": ">=7.2",
},
"require-dev": {
"ext-curl": "*"
},
"authors": [
{
"name": "John Smith",
"email": "jsmith#test.tv"
}
],
"autoload" : {
"prs-4": {
"Company\\MyCustomPackage\\": "src/"
}
},
"minimum-stability": "dev"
}
File: laravel-project/packages/my-custom-package/src/MyCustomPackageServiceProvider.php
<?php
namespace Company\MyCustomPackage;
use Illuminate\Support\ServiceProvider;
class MyCustomPackageServiceProvider extends ServiceProvider {
public function boot()
{
$this->loadRoutesFrom(__DIR__ . '/routes/web.php');
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
}
public function register()
{
}
}
File: laravel-project/composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"repositories": [
{
"type": "path",
"url": "~/testlaravel/packages/my-custom-package",
"options": {
"symlink": true
}
}
],
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"guzzlehttp/guzzle": "^6.3.3",
"company/my-custom-package": "dev-master"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"prs-4": {
"Company\\MyCustomPackage\\": "~/testlaravel/packages/my-custom-package/src"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Explanation: ~/testlaravel/ is folder path inside Vagrant machine for project originaly url was "packages/my-custom-package" buti changed for this extended version just in pure attempt of making it work.
File: config/app.php (added service provider)
Company\MyCustomPackage\MyCustomPackageServiceProvider::class
Issue:
First i made this thing localy and it worked i was following for quick setup instructions from
"Create Laravel Composer Package from scratch to upload on packagist" Author: Bitfumes, and package worked, I could run composer update, then i added to app.php my package and i could run custom route and it all worked.
After that i moved package to git repo, and required it in same way only changed "repositories" field to
"repositories": [
{
"type": "vcs",
"url": "git#git.fulllink.co:john/my-custom-package.git"
}
]
and when you run composer update, you can see that afterwards inside vendor/ files you have Company folder with package inside it, BUT if you leave config/app.php service provider it starts to complain that there is
*Class 'Company\MyCustomPackage\MyCustomPackageServiceProvider' not fo und*
After some f*** around i found out that yes my autoload_classmap (cant remember original post) did not contain my package , so today i decided to try again local and see the difference, does it been added to map file, and now i get same error when requiring local package and i can't make it work anymore.
I been deleting vendor folder and lock file , composer dump-autoload, but that doesnt help. Im just thinking is thgere anything else supercached?
!!UPDATE!!
Im not even more confused. In composer.json (project one i tested on actual project repo now where is required another 2 local git repos). So i have now 4 packages in vendor/Company/{4 packages} , i compared all 4 package composer.json and i can't find any major difference but all of them have been loaded to autoload mapping except mine. Only major difference i can see, those two packages doesnt use ServiceProvider.php file , but i dont see how that impacts or changes things.

How install the latest PHP minor branch version with composer

I am trying to manage branch with version number to have a control of the code. So I have a branch "0.7" and from this I create another branch "0.7.1" with a lot of changes.
I'm trying to install in other project my package with "0.7.1" branch code, and as the composer documentation say, the way to do this is define the jida dependency as "0.7.x-dev". But when I run "composer update" composer only download the 0.7 version and not the latest. I tried a lot of things but i can't download the 0.7.1 version. I want to fix this because my idea is later make a 0.7.2 versions and keep like that.
{
"type": "website",
"minimum-stability": "dev",
"license": "mit",
"authors": [
{
"name": "jr0driguez",
}
],
"require": {
"phpmailer/phpmailer": "^5.2",
"ext-json": "*",
"ext-gd": "*",
"jida/framework": "0.7.x-dev",
"ext-curl": "*"
},
"autoload": {
"psr-4": {
"App\\": [
"./Aplicacion/"
]
}
},
"scripts": {
"post-install-cmd": [
"npm install"
],
"post-update-cmd": [
"npm update"
]
}
}
I put an image with composer message where shows the ""
If your branch name is 0.7.1, you should use 0.7.1.x-dev as a constraint:
"jida/framework": "0.7.1.x-dev",
I resolved the trouble adding the "repositories" property into the composer.json from the project where I was installing the dependency.
This was the part:
{
"type": "git",
"url": "https://github.com/jidadesarrollos/jida",
"name": "jida/framework"
}
I set the "name" property to cofirm the dependency name, I think must be the same. And with this I could specify the branch name that I was needing to install
"jida/framework": "dev-desarrollo",
The branch where I'am working. I hope the post be useful to another.

Can't require local package with composer

I'm currently working on a Composer package and now I want to test how it would integrate in my current application without pushing it to a remote.
So I stumbled upon this blog post which explains how to do that. However, that didn't work. I'm getting the message
Your requirements could not be resolved to an installable set of packages.
Problem 1 - The requested package tzfrs/x-bundle could not be found in any version, there may be a typo in the package name.
My directory structure looks like this
dev
Project
composer.json
Package
composer.json
The composer.json of my package looks like this
{
"name": "tzfrs/x-bundle",
"license": "proprietary",
"require": {
"php": "^7.0",
"psr/log": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~5.5"
},
"autoload": {
"psr-4": { "tzfrs\\XBundle\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
}
}
And the one of my project looks like this (I'm leaving the symfony stuff and other packages/stuff out)
{
"repositories": [
{
"type": "git",
"url": "../Package",
}
],
"minimum-stability" : "beta",
"require": {
"tzfrs/x-bundle": "*"
}
}
So when doing composer update tzfrs/x-bundle I should get my new project right? However, I'm getting the message I posted above. What am I doing wrong here?
I already did git init in my package folder and also comitted all my changes. So I have a repo which is not empty already.

Class validator not found in respect validation Lib

I'm new in composer but I could get vendor, composer.lock and composer.json from cmd then I paste them to my project without Validation_Master folder.
My project Path: C:\wamp64\www\php Projects\project 1\(here there are test.php and vendor, composer.lock and composer.json)
Validation_Master folder path: C:\wamp64\www\php Projects\Validation_Master
My Code is:
<?php
require "vendor/autoload.php";
use Respect\Validation\Validator as v;
$number = 123;
v::numeric()->validate($number);
?>
But the above code gives me the following error :
Fatal error: Class 'Respect\Validation\Validator' not found in
C:\wamp64\www\php Projects\project 1\test.php
What did I do?!!?
copy Validation_Master folder to the path of test.php ==> (Failed )
copy Vendor folder to the path of Validation_Master folder and required from there ==> (Failed )
Manipulate namespace a lot and add namespace Respect\Validation to the code ==> (Failed )
What's The PROBLEM ????
How Can I use Respect Validation Library ????? Please answer me basically (I read docs before but didn't help)
vendor folder image
composer.json code:
{
"name": "respect/validation",
"description": "The most awesome validation engine ever created for PHP",
"keywords": ["respect", "validation", "validator"],
"type": "library",
"homepage": "http://respect.github.io/Validation/",
"license": "BSD Style",
"authors": [
{
"name": "Respect/Validation Contributors",
"homepage": "https://github.com/Respect/Validation/graphs/contributors"
}
],
"require": {
"php": ">=5.6"
},
"require-dev": {
"egulias/email-validator": "~1.2",
"malkusch/bav": "~1.0",
"mikey179/vfsStream": "^1.5",
"phpunit/phpunit": "~5.3",
"symfony/validator": "~2.6.9",
"zendframework/zend-validator": "~2.3"
},
"suggest": {
"ext-bcmath": "Arbitrary Precision Mathematics",
"ext-mbstring": "Multibyte String Functions",
"egulias/email-validator": "Strict (RFC compliant) email validation",
"malkusch/bav": "German bank account validation",
"symfony/validator": "Use Symfony validator through Respect\\Validation",
"zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation",
"fabpot/php-cs-fixer": "Fix PSR2 and other coding style issues"
},
"autoload": {
"psr-4": {
"Respect\\Validation\\": "library/"
}
},
"autoload-dev": {
"psr-4": {
"Respect\\Validation\\": "tests/library/"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"scripts": {
"test": "./vendor/bin/phpunit"
}
}
the autoload.php code :
<?php
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit46e0d859a60be6f2acf30ed92a2228ad::getLoader();
I appreciate and sorry that I've written a lot
UPDATE : My problem like this post : Why my autoload.php of composer doesn't work?, but it didn't help
I also run composer dump-autoload in cmd ==> (failed)
It looks to me like you copied the composer.json of the respect/validation library, and tried to use it as the composer.json for your project. This is a completely wrong approach.
Use this as your project composer.json:
{
"require": {
"respect/validation": "^1.0"
}
}
Then:
run composer install,
run your script again.

Categories