Coder Social home page Coder Social logo

Comments (5)

codedge avatar codedge commented on June 23, 2024

Sorry for the late answer!
Did you try regenerating your Composer autoload classes with composer dump-autoload?

I tried with Laravel 5.3 both ways:

  • Separate Controller
  • Definition in routes/web.php as you did

Works flawlessly!

from laravel-fpdf.

kroky avatar kroky commented on June 23, 2024

May I suggest where the source of the problem is?
src/Fpdf/fpdf.php file defines a class named FPDF and the service provider searches for the correct class name FPDF all uppercase. However, it seems the psr-4 autoloader expects file name to match class name in case-sensitive fashion:
http://www.php-fig.org/psr/psr-4/

I have this failing with laravel 4.2 project with same error of Class not found. Renaming fpdf.php to FPDF.php fixes the problem. Not sure why it works sometimes but it seems file name must be fixed...

from laravel-fpdf.

codedge avatar codedge commented on June 23, 2024

Thanks @kroky for checking. I'll try to investigate and will fix if I can reliably reproduce it. A better naming could indeed be a solution.

from laravel-fpdf.

huchenhai avatar huchenhai commented on June 23, 2024

@kroky Thank you very much kroky, i'm also facing this problem. Your solution perfectly solved it , guess psr-4 couldn't find the correct file with difference on upper/lower case. As a class has to be start with Upper case , i just renamed filename as well, everything working perfectly.
cheers

from laravel-fpdf.

patombugua avatar patombugua commented on June 23, 2024

make sure you rename the file fpdf.php in src/Fpdf so that it start with a capital letter

from laravel-fpdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.