I have an laravel application and I need to install this package lunar-calendar
I install it and the package shows in vendor folder:
The package documentation tells to required the package like this:
use yzha5\LunarCalendar;
I put this way but also try this in controller:
use App\yzha5\LunarCalendar;
but returns not found.
I also run the command to publish vendor but doesn't work.
How can I use this package?
The package doesn't contain a service provider, so publish vendor will accomplish nothing really.
use yzha5\LunarCalendar;
\\ will not work because it isn't registered in your service provider that this alias equals the package path
use App\yzha5\LunarCalendar;
\\ will not work because there isn't a folder in app directory named yzha5.
Since it's just two classes and not exactly a decently build package, I'd just fetch those two files into a directory at your choosing, change the namespace and call them.
If you look at the package composer.json
file, you can see the library namespace is mapped to the src/
directory as follows:
"yzha5\\LunarCalendar\\": "src/"
Therefore, to use the class your use
statements need to be:
use yzha5\LunarCalendar\LunarCalendar;
$array = LunarCalendar::solarToLunar(1984, 9, 22);
TL;DR - the README.md documentation is wrong.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.