Hi, I want to use the package DamerauLevenshtein, installed it through composer but its not working... need some help (i'm and old programmer not good with namespaces)
In the same codeigniter project I have installed through composer phpoffice/phpexcel and its working ok, so its not related to composer or codeigniter.
I have in the config
went to packagist, search for my package https://packagist.org/packages/oefenweb/damerau-levenshtein
and then open command in application folder and install it
after install, checked all files in place, its installed in
its header is
in my controller I have
and i have when called an error exception
on the line: "$dl = new DamerauLevenshtein(..."
I have tried with all posible combinations on top of the class , with and without the require of the autoload, change namespace... its all the same...
so i'm stuck... always the same error.
What am I doing wrong?
PS: I really need this, the PHP levenstein function does not work for me because of the type of strings i will be testing.
In the same codeigniter project I have installed through composer phpoffice/phpexcel and its working ok, so its not related to composer or codeigniter.
I have in the config
PHP Code:
$config['composer_autoload'] = APPPATH.'vendor/autoload.php';
went to packagist, search for my package https://packagist.org/packages/oefenweb/damerau-levenshtein
and then open command in application folder and install it
Quote:composer require oefenweb/damerau-levenshtein
after install, checked all files in place, its installed in
Quote:application\vendor\oefenweb\damerau-levenshtein\src\DamerauLevenshtein.php
its header is
PHP Code:
<?php
namespace Oefenweb\DamerauLevenshtein;
/**
* Compute Damerau-Levenshtein distance of two strings.
*
* For more information about algorithm
* @see http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
*/
class DamerauLevenshtein
{
(...)
in my controller I have
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Oefenweb\DamerauLevenshtein;
//these are for the phpexcel part, and their code works ok reading and writing excels
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class Test extends CI_Controller {
public function test1()
{
$string1 = 'SMITH JONES, JACK';//these are random ^_^
$string2 = 'JACK SMITH JONES';
$dl = new DamerauLevenshtein($string1,$string2, 1,1,1,1);
$sim = $dl->getSimilarity();
//for test
var_dump($sim);
}
(...)
}
and i have when called an error exception
PHP Code:
Type: Error
Message: Class 'Oefenweb\DamerauLevenshtein\DamerauLevenshtein' not found
Filename: C:\wamp\www\testproject\application\controllers\Soundex.php
on the line: "$dl = new DamerauLevenshtein(..."
I have tried with all posible combinations on top of the class , with and without the require of the autoload, change namespace... its all the same...
Quote:require_once APPPATH."vendor/autoload.php';
use Oefenweb\DamerauLevenshtein;
or
require_once APPPATH."vendor/autoload.php';
use Oefenweb\DamerauLevenshtein\DamerauLevenshtein;
so i'm stuck... always the same error.
What am I doing wrong?
PS: I really need this, the PHP levenstein function does not work for me because of the type of strings i will be testing.