XAMP PHP class not found

Alles, was PHP betrifft, kann hier besprochen werden.

XAMP PHP class not found

Postby rgwells » 08. April 2024 23:08

I have a PHP application that uses composer to manage it's dependencies. The application works great in XAMPP so far. I just added the ramsey\Uuid\Uuid library to my application. Unfortunately, when I run the application I get a

Uncaught Error: Class "Ramsey\Uuid\Uuid" not found in ...

when the class is used. It there something I need to do to add this library to XAMPP?
rgwells
 
Posts: 1
Joined: 08. April 2024 23:04
XAMPP version: 8.2.4
Operating System: Wiwdows 10

Re: XAMP PHP class not found

Postby Aar » 19. May 2024 18:03

This has little to do with XAMPP. How do you call the class? Do you also use the AutoLoader? And have you applied the namespaces correctly in PHP?

At the very least, your script should look like this at the beginning:
Code: Select all
<?php
require 'vendor/autoload.php';

use Ramsey\Uuid\Uuid;

/* Do more */
?>
User avatar
Aar
 
Posts: 29
Joined: 18. November 2014 18:36
Operating System: Windows and Linux (non XAMPP)


Return to PHP

Who is online

Users browsing this forum: No registered users and 82 guests