Home > Backend Development > PHP Tutorial > How to introduce third-party references installed by composer in vendor in laravel

How to introduce third-party references installed by composer in vendor in laravel

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-04 09:19:22
Original
2499 people have browsed it

In my laravel framework, I want to create a full-text search function, but I think the efficiency based on mysql's like%xx% is too low. After comparison, xunsearch supports Chinese search, so I decided to use it.
After installing xunsearch on the vendor in the root directory composer, I directly require the entry file according to the traditional method

How to introduce third-party references installed by composer in vendor in laravel

But if I use new XS(), it will prompt me

How to introduce third-party references installed by composer in vendor in laravel
XS not found.
Laravel references the code in the vendor, can’t it be required directly? Do I need to use a server container or something? I looked at the documentation and I don’t quite understand how to use it.............

Reply content:

In my laravel framework, I want to create a full-text search function, but I think the efficiency based on mysql's like%xx% is too low. After comparison, xunsearch supports Chinese search, so I decided to use it.
After installing xunsearch on the vendor in the root directory composer, I directly require the entry file according to the traditional method

How to introduce third-party references installed by composer in vendor in laravel

But if I use new XS(), it will prompt me

How to introduce third-party references installed by composer in vendor in laravel
XS not found.
Laravel references the code in the vendor, can’t it be required directly? Do I need to use a server container or something? I looked at the documentation and I don’t quite understand how to use it.............

You first take a look at the xunsearch introduced by composer. There is a composer.json under the vendor. It tells you that its namespace has a PSR path in autoload

Laravel has the xunsearch extension package, and Laravel uses the namespace supported since PHP5.3, so there is no need for a require/include file.

Laravel uses psr4 automatic loading standard, you only need to configure the loading path in composer.json

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template