Class 'Solarium\Client' not found in /var/www/index.php - php

I am a php noob. I'm trying to use Solarium to connect to Solr. I installed solarium using composer. I autoloaded solarium using the following line:
require __DIR__.'/vendor/autoload.php';
I'm trying to test the Solarium version now, just to see if everything is fine. I am using the code from the examples: echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - '; for printing the version.
However, I get the following error:
Fatal error: Class 'Solarium\Client' not found in /var/www/index.php
I have tried using use Solarium\Client; before using Solarium\Client as suggested here but the same error still came up. What is causign this and how does fix it?

You can easily get it working by reinstalling solarium using composer.
First of all remove solarium from composer.json.
Then run composer update
After that add latest version of Solarium in composer.json as "solarium/solarium": "3.3.0" in require.
Then run composer install
Then try your ping query.
Hope it helps.

Related

Command "make:datatable" is not defined

https://github.com/rappasoft/laravel-livewire-tables
I have installed the package via composer and when I try to use the make:datatable command to create a data table, I get the error Command "make:datatable" is not defined. ' It would be of great help if someone could help me out. Thank you.
https://github.com/rappasoft/laravel-livewire-tables
You try update your version of php, that corrected my problems at least is 7.4, for the commands
I installed the package via composer and in my composer.json the installed version was 0.4.0 .
I noticed that in the docs there is a note: This feature is available in v1.12 and above .
I changed the version directly in my composer.json to ^1.21 (this is the latest version at the moment) and then just run update composer and it worked.

How to fix this scsuoft/laravel-exception-notification error?

I am using PHP version 7.2.19 and Laravel 5.6.39. I am getting this scsuoft/laravel-exception-notification error when I run composer install.
When I check the link it is not available and I also try to delete the scsuoft file manually but when I run composer install again the file is automatically added and I keep getting the same error.
Also, if I try composer require jeremykenedy/laravel-exception-notifier
Try composer require jeremykenedy/laravel-exception-notifier. After some digging i found there's no scsuoft/laravel-exception-notification anywhere.

Any PHP framework using latest mongodb driver?

Am searching for PHP framework which supports PHP7 and latest php mongo driver (https://github.com/mongodb/mongo-php-driver) using 1.1.8 (https://pecl.php.net/package/mongodb)
I tried with codeignitor and fatfree but they seems to support old one. Any help is appreciated.
Thanks,
Zeeshan
If you are using codeignitor then you can install library through composer (you need to install composer first if you dont have)
Then go to your project directory through command line and run the following command
composer require "mongodb/mongodb=^1.0.0
It will install mongodb library in your vendor folder of your project.
Then you need to include following line where you want to use the library for eg you can include it on top of your controller or model.
require 'vendor/autoload.php';

PHP - solarium with composer and Silex

I've installed solarium with composer using below commands in ubuntu:
php composer.phar require solarium/solarium
I've also used silex micro framework. After installing solarium, when I tried to run sample php file in examples folder, I got error
"Fatal error: Class 'Solarium\Client' not found in
/api/vendor/solarium/solarium/examples/1.1-check-solarium-and-ping.php on line 7"
How to get this work as expected?
I want to use both silex and solarium in a project.

How to Include or Autoload Class Files in Solarium for SOLR

I'm Trying to include or autoload Solarium for SOLR in PHP and I keep getting errors. I know I'm doing it incorrectly but I'm new to autoloading. I have the extension installed for php and that works. Here is the error I receive:
Fatal error: Class 'Solarium\Client' not found in /Users/...
Here is my php file with code I'm testing—I realize that there is no autoloading setup in my example, I'm new to autoloading confused at how to use it:
<?php
require(__DIR__.'/init.php');
// check solarium version available
echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - ';
The preferred way to install Solarium is by using Composer. Solarium is available on Packagist. For more info see https://github.com/solariumphp/solarium

Categories