Reputation: 6697
I usually use this library for my Laravel projects. I download it like this:
$ composer require morilog/jalali
And Add these lines to the config/app.php
file of my Laravel projects:
'providers' => [
Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
Illuminate\Auth\AuthServiceProvider::class,
...
Morilog\Jalali\JalaliServiceProvider::class,
],
'alias' => [
...
'jDate' => Morilog\Jalali\Facades\jDate::class
]
It works and all fine.
Now I need to use this library in a pure PHP project. It has its own MVC structure and doesn't have config/app.php
. I downloaded the library like always (composer require morilog/jalali
, and both composer.json
file and vendor
directory are created). Does anybody know how can I use it in my codes? Do I need to require()
something? Or use
something?
Upvotes: 2
Views: 1510
Reputation: 1043
You can still use compoaser
in this case. You can add this line in your, say index.php
file:
require __DIR__ . '/../vendor/autoload.php';
And rest, you can use it the same way you're using it in Laravel
right now.
Upvotes: 1
Reputation: 15616
Run
composer require morilog/jalali
in your "pure PHP" project's root folder, and then
include "vendor/autoload.php"
in your root file if you use one, or in the file that you are planning to use composer libraries.
Then call the class with the full namespace as :
$jDate = new Morilog\Jalali\Facades\jDate
Upvotes: 3