im working in a plugin in localhost, it works fine in my localhost website
im using composer in it but then when i upload it to my website then it trows a fatal error because composer autoload is not working, in the php file with the same name as my plugin i require the vendor autoload, the errors says that the files that i call wiht autoload do not exists i dont know to much about php or composer, i cant understand why in localhost works but not in my online website dont, the vendor file exists, as i saw in the cpanel directory and then i try to upload the same plugin to other local website an it worked fine, the problem is when i upload it to the website
this is the error
Fatal error: Uncaught Error: Class ‘IncBaseCreateOrDropTables’ not found in /home/hoteljupiterve/test.hoteljupiterve.com/wp-content/plugins/booking-jupiter/booking-jupiter.php:35 Stack trace: #0 /home/hoteljupiterve/test.hoteljupiterve.com/wp-includes/class-wp-hook.php(286): activate_booking_plugin(”) #1 /home/hoteljupiterve/test.hoteljupiterve.com/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array) #2 /home/hoteljupiterve/test.hoteljupiterve.com/wp-includes/plugin.php(465): WP_Hook->do_action(Array) #3 /home/hoteljupiterve/test.hoteljupiterve.com/wp-admin/plugins.php(177): do_action(‘activate_bookin…’) #4 {main} thrown in /home/hoteljupiterve/test.hoteljupiterve.com/wp-content/plugins/booking-jupiter/booking-jupiter.php on line 35
and this is my booking-jupiter.php
<?php
/**
* @package booking-jupiter
*/
/*
Plugin name: booking-jupiter
Plugin URI: http://localhost/PluginPrueba
Description: plugin de reserva de habitaciones
Version: 1.0.0
Author: Guillermo Marin
Author URI: https://www.hoteljupiterve.com
License: GPLv2 or later
Text Domain: booking-jupiter
*/
// define el absolute path, lo primero que hay que hacer siempre
if ( ! defined('ABSPATH')) {
echo 'error bro, el die mato todo ';
die;
}
// busca a vendor en composer para usar el use y namespase
if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) {
require_once dirname( __FILE__ ) . '/vendor/autoload.php';
}
// activo y desactivo el plugin de manera procedural, es la forma en la que pide wordpress
function activate_booking_plugin()
{
IncBaseCreateOrDropTables::create_all_tables();
IncBaseCreateClient::create_client_role();
// (new IncBaseCreateOrDropTables())->create_all_tables();
}
function deactivate_bookin_plugins()
{
IncBaseDeactivateBooking::deactivate();
}
// ya cree las funciones y bueno estos metodos de wordpress hacen el trabajo
register_activation_hook( __FILE__, 'activate_booking_plugin' );
register_deactivation_hook( __FILE__, 'deactivate_bookin_plugins' );
// busca si exite la clase Init para darle con el registerservices y asi que todos los demas se inicialicen perro
if ( class_exists( 'Inc\Init' ) ) {
IncInit::register_services();
}
thats all my booking-jupiter.php, i cant activate the plugin because of that error and if use require once to the CreateOrDropTables when i try the same with the Inc/init.php. it says that the class do no exists
i just try to eliminate the vendor folder and composer.json file from the cpanel an then i did install composer from the cpanel to my plugin folder, i didnt work i got the same error