PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 22, 2022

[FIXED] Class not being autoloaded

 January 22, 2022     composer-php, php, psr-4     No comments   

Issue

I've made a little library for myself and I'm trying to autoload it into my laravel project, it installs fine but whenever I try to use the class it simply says it's not found.

I've checked all the classmap files in vendor/composer and it doesn't seem to be in any of them.

This is my composer.json for my lib:

{
    "name": "my-user/aspect-parser",
    "version": "1.0.0",
    "type": "package",
    "require": {
        "nesbot/carbon": "^1.22"
    },
    "autoload": {
      "psr-4": {
        "AspectParser\\": "src/"
      }
    }
}

My file structure is:

  • AspectParser
    • src
      • Parser.php

Solution

It was an issue with the type in composer.json. I've changed it to library and it adds to the autoload classmap.



Answered By - Nathan
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing