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?

4
  • 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. Commented Jan 23, 2018 at 14:11
  • have you tried without use MatthiasMullie\Minify;? Commented Jan 23, 2018 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. Commented Jan 31, 2018 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. Commented Jan 31, 2018 at 14:20

1 Answer 1

2

You have to require CSS.php:

require_once 'minify/src/CSS.php';

Sign up to request clarification or add additional context in comments.

1 Comment

Yep, that's the issue.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.