PHP code example of vaites / php-apache-tika
1. Go to this page and download the library: Download vaites/php-apache-tika library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vaites / php-apache-tika example snippets
$client = \Vaites\ApacheTika\Client::make('localhost', 9998); // server mode (default)
$client = \Vaites\ApacheTika\Client::make('/path/to/tika-app.jar'); // app mode
$client = \Vaites\ApacheTika\Client::prepare('localhost', 9998);
$client = \Vaites\ApacheTika\Client::prepare('/path/to/tika-app.jar');
$client = \Vaites\ApacheTika\Client::make('http://localhost:9998');
$client = \Vaites\ApacheTika\Client::prepare('http://localhost:9998');
$language = $client->getLanguage('/path/to/your/document');
$metadata = $client->getMetadata('/path/to/your/document');
$html = $client->getHTML('/path/to/your/document');
$text = $client->getText('/path/to/your/document');
$client = \Vaites\ApacheTika\Client::make($host, $port);
$metadata = $client->getMetadata('/path/to/your/image');
$text = $client->getText('/path/to/your/image');
$client->getMetadata($file);
$client->getRecursiveMetadata($file, 'text');
$client->getLanguage($file);
$client->getMIME($file);
$client->getHTML($file);
$client->getXHTML($file); // only CLI mode
$client->getText($file);
$client->getMainText($file);
$client->getSupportedMIMETypes();
$client->getIsMIMETypeSupported('application/pdf');
$client->getAvailableDetectors();
$client->getAvailableParsers();
$client->getVersion();
$client->getEncoding();
$client->setEncoding('UTF-8');
$client->getSupportedVersions();
$client->isVersionSupported($version);
$client->setCallback($callback);
$client->getCallback();
$client->setChunkSize($size);
$client->getChunkSize();
$client->setDownloadRemote(true);
$client->getDownloadRemote();
$client->setFetcherName($fetcher); // one of FileSystemFetcher, HttpFetcher, S3Fetcher, GCSFetcher, or SolrFetcher
$client->getFetcherName();
$client->setPath($path);
$client->getPath();
$client->setJava($java);
$client->getJava();
$client->setJavaArgs('-JXmx4g');
$client->getJavaArgs();
$client->setEnvVars(['LANG' => 'es_ES.UTF-8']);
$client->getEnvVars();
$client->setHost($host);
$client->getHost();
$client->setPort($port);
$client->getPort();
$client->setUrl($url);
$client->getUrl();
$client->setRetries($retries);
$client->getRetries();
$client->setOptions($options);
$client->getOptions();
$client->setOption($option, $value);
$client->getOption($option);
$client->setTimeout($seconds);
$client->getTimeout();
$client->setHeader('Foo', 'bar');
$client->getHeader('Foo');
$client->setHeaders(['Foo' => 'bar', 'Bar' => 'baz']);
$client->getHeaders();
$client->setOCRLanguage($language);
$client->setOCRLanguages($languages);
$client->getOCRLanguages();
$client->setFetcherName($fetcherName)
bash
composer