0

I am trying to implement minify and I have the below code and error. Minify folder is in the same as the index.php

CODE:

<?php
require_once 'minify/src/Minify.php';
require_once 'minify/src/JS.php';
require_once 'minify/src/Exception.php';

use MatthiasMullie\Minify;

$cssMin = new Minify\CSS('assets/css/myCssFile.css');

Error in error_log file:

[23-Jan-2018 05:14:12 America/New_York] PHP Fatal error: Class 'MatthiasMullie\Minify\CSS' not found in /home/johannes/public_html/2018/index.php on line 8

How can I fix this problem?

RealSollyM
  • 1,530
  • 1
  • 22
  • 35
  • I have tried a few possible solutions posted here but they all failed. I cannot use the `autoloader` because of the permissions on the server but I hope I can use the files directly. – RealSollyM Jan 23 '18 at 14:11
  • have you tried without `use MatthiasMullie\Minify;`? – Professor Abronsius Jan 23 '18 at 14:12
  • @Machavity - I don't see how these two questions are the same. The one you refer to as a duplicate is not even mentioning the `Class Not Found` problem. Please remove the down vote. – RealSollyM Jan 31 '18 at 14:17
  • @RamRaider - Yes I tried. Unfortunately the examples, and steps of getting this right, are not fully shown or explained. I thought the `CSS` class was primarily part of the `Minify` file, and that the `JS` class was an extension. – RealSollyM Jan 31 '18 at 14:20

1 Answers1

2

You have to require CSS.php:

require_once 'minify/src/CSS.php';

toooni
  • 347
  • 2
  • 8