Class not found after authentication installed

Following the quick start guide here:

https://book.cakephp.org/authentication/3/en/index.html

I executed the command

composer require cakephp/authentication

and got some errors in the command prompt. Then I refreshed my localhost and got the same error as I got for a previous forum post:

Fatal error: Uncaught Error: Class “App\Application” not found in C:\xampp\htdocs\pp-5-0-6\webroot\index.php:34 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pp-5-0-6\webroot\index.php on line 34

That was for the version 5.0.6 download. So I downloaded version 5.0.7 and tried again. I got errors in the command prompt again. I ran the command composer require cakephp/authentication again and got the error about Class “App\Application” not found again.

There were 7 error messages for version 5.0.6 and 5 error messages for version 5.0.7. The error messages were a variation of this:
Failed to download cakephp/utility from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:\xampp\php\php.ini
Now trying to download from source

  • Syncing cakephp/utility (5.0.7) into cache

Uncommented the zip extension in php.ini, stopped the server, and ran composer require cakephp/authentication again. The result was: Nothing to install, update or remove
Refreshed my localhost and still got the error about Class “App\Application” not found.
Also I changed the permissions on the src folder to full control.
I am using XAMPP and PHP version 8.2.12.

I tried to disable the read-only attribute of the src folder but every time I applied the change, it switched back to read-only.

I used the following command in the command prompt to clear the read only attribute:
attrib -R -S C:\xampp\htdocs\propot-v-5-0-6
When I used Windows File Explorer to view the folder properties, the read only attribute was still checked.
Maybe you all use Linux like KevinPfeiffer does?
I found another source that said to navigate to the folder you want to modify and use attrib -r /s /d in the command prompt but it didn’t work either. However it seemed to change something because it listed all the hidden .git files that it wasn’t able to reset.
I also gave all users full control permissions.
I’m not sure that read-only folder is the problem because before I installed the authentication, the default website was working.

If you’re referring to the item shown in the screenshot below, then you’re wasting your time. All folders will display that “Read-only” item. It’s essentially meaningless. If you’re having a particular issue, the problem lies elsewhere, so please clarify what you’re trying to achieve.

But if you check the box, it is a command to tell Explorer to make all files in the folder read-only (it will ask for confirmation). It can also be unchecked to make all files in the folder not read-only. But it will always display a solid box!

SOURCE
https://answers.microsoft.com/en-us/windows/forum/all/how-to-remove-read-only-from-windows-10-folders/c1d2620b-01c2-47ea-91c2-2a753178b668#:~:text=Right-click%20on%20the%20folder,to%20all%20subfolders%20and%20files.

SEE ATTACHED SCREENSHOT


The screenshot shows that read-only has to have a checkmark. My folder looks like the one on the left so it’s not read-only.

I installed 7z with winget install 7zip.7zip in the command line and ran composer update also in the command line and still the error persisted.
If I switched to a Linux operating system, would someone be able to help me?

I just looked through your initial post and was wondering: Did you just execute

composer require cakephp/authentication

inside an empty folder or inside a CakePHP app?

I executed it inside the CakePHP app.

Did the app work before you executed that command?

This error indicates that not even the base cakephp/app installation worked so make sure this works before trying to setup authentication.

Also maybe try to follow my workshop where I go step by step:

Yes, the app worked before I installed authentication.
I did a fresh installation of CakePHP again after installing 7zip and uncommenting the zip extension in php.ini. I ran composer require "cakephp/authentication:^3.0" and I didn’t get any error messages this time but the error about the missing class persisted.

I’m watching the video now and I see that I didn’t do the following step:
composer create-project ---prefer-dist cakephp/app <project-name>
I don’t know that I need to execute the command above because I downloaded cakephp and installed it without using composer. I was able to get to the default home page after downloading it without composer.

How did you manually download cakephp…

I downloaded it from this site;

This is the core framework, not the app template. This of course can’t run standalone because it contains the parts to build the app template.

What you need (and you get when doing the installation correctly via composer create-project) is this repository: GitHub - cakephp/app: CakePHP application template

You could have also just followed the installation guide Installation - 4.x

The readme on GitHub - cakephp/cakephp: CakePHP: The Rapid Development Framework for PHP - Official Repository even says:

You can install CakePHP into your project using Composer. If you’re starting a new project, we recommend using the app skeleton as a starting point.

The

composer require cakephp/cakephp

is only meant for other, non-cakephp applications which need to have cakephp functionality added to them

I created the app using: composer create-project --prefer-dist cakephp/app:~5.0 pp_new-version

Then I ran: composer require "cakephp/authentication:^3.0"

Still get the error: Uncaught Error: Class “App\Application” not found
Do I have to bake the app before the class can be found? I’m still watching the video.

you are missing a crucial step… you need to go into the directory which is being created by the first command.

composer create-project --prefer-dist cakephp/app:~5.0 pp_new-version
cd pp_new-version
composer require "cakephp/authentication:^3.0"

When I run: cake bake all users
I get the error:
PHP Fatal error: Uncaught Error: Class “Cake\Console\CommandRunner” not found in C:\xampp\htdocs\pp_new-version\bin\cake.php:9

When the app was being created, I answered yes to the following question:
Set Folder Permissions ? (Default to Y) [Y,n]? y

I did go into the directory created by the create-project command before running the require command. I just didn’t say so in my post.