monkenWu / TablesIgniter

Tableslgniter is an addins base on CodeIgniter4. It will help you use jQuery Datatables in server side mode.
https://tablesigniter.monken.tw/
MIT License
14 stars 7 forks source link

class not found #10

Closed 404Nekorara closed 3 years ago

404Nekorara commented 3 years ago

hi, i'm trying to implement this library with my ci-4 app. but this always return error class not found. i've already install composer and use monken\TablesIgniter on my app controller. idk why.. i'm currently use codeigniter 4.1.1. and there is my sample sourcecode.

` namespace App\Controllers; use App\Controllers\BaseController; use monken\TablesIgniter; use App\Models\Transaction; use CodeIgniter\API\ResponseTrait; use CodeIgniter\RESTful\ResourceController;

public function otherdatatables() { $table = new TablesIgniter(); $Transaction = new Transaction(); $table->setTable($Transaction->datatableList()) ->setDefaultOrder("id", "DESC") ->setOutput([ "id", "buyer", "created_at as created" ]); return $table->getDatatable(); } `

monkenWu commented 3 years ago

Hello there! Does the PHP file {Project Root} /vendor/monken/tablesigniter/src/TablesIgniter.php exist?

404Nekorara commented 3 years ago

no, there is only .circle, app, public, tests, writeable folder. im Using version ^1.1 for monken/tablesigniter

monkenWu commented 3 years ago

You must install Codeigniter4 through Composer to use this library.

germs2611 commented 3 years ago

Hey, am having the same problem even though I install and create the project with composer. There is no /vendor/monken/src/TablesIgniter.php file. Hence Class "monken\TablesIgniter" not found error.

germs2611 commented 3 years ago

The library files are not been downloaded.

monkenWu commented 3 years ago

@germs2611 Hi,Have you installed the library using the following commands in your project-root directory? composer require monken/tablesigniter If you executed the installation command, please check if the following files exist: {Project Root} /vendor/monken/tablesigniter/src/TablesIgniter.php

germs2611 commented 3 years ago

Yes I did. I even created a another project from scratch using composer an when a I ran the command composer require monken/tablesigniter in the project root the same thing happen. That src folder is not showing up.

image

germs2611 commented 3 years ago

I have downloaded the zip file. Can it be added manually by creating the src folder and if so how do I add it to be auto loaded.

monkenWu commented 3 years ago

Hi I don't see "vendor" in your directory structure, can you try to execute the following command in the project root directory? composer install

germs2611 commented 3 years ago

image

1m-Arthur commented 3 years ago

Hi guys, i have the same problem, but i solve this problem with manually adding this repo on library branch to my app_path/vendor/monken/tablesigniter/src/ ${your_project_path}/vendor/monken/tablesigniter/src/

hopefully solve your problem cheers~

germs2611 commented 3 years ago

Hi 1m-Arthur, could you tell me exactly which file am suppose to put that in C4. Or if you have a snippet.

Thanks.

1m-Arthur commented 3 years ago

Hi @germs2611, you can clone or download this. https://github.com/monkenWu/TablesIgniter/tree/library

germs2611 commented 3 years ago

Hi @1m-Arthur, I have downloaded he file but I want to know how I add it to my project. Create a src folder and add the TablesIgniter.php file and how do I add to the APPPATH.

Thanks

1m-Arthur commented 3 years ago

@germs2611 whoops, i'm sorry. if you already done adding this file ${your_project_path}/vendor/monken/tablesigniter/src/TablesIgniter.php to your project path. that's mean this library is ready to use and you can try some Quick Start guide.

germs2611 commented 3 years ago

Hi @1m-Arthur, sorry for the confusion. I tried your steps before but am wondering if am missing something. The CI4 framework throwing a Class "monken\TablesIgniter" not found error. The autoloader not finding the TablesIgniter.php file when I add it manually. Is there some other configuration that am suppose to do so it can find it.

Thanks

monkenWu commented 3 years ago

@germs2611 Hi, can you provide the "monken/tablesigniter" part of "composer.json" and "composer.lock"? These files will appear in your project root directory.

germs2611 commented 3 years ago

Hi @monkenWu image

image

monkenWu commented 3 years ago

@germs2611

Please try to delete the library and reinstall the specified version.

composer remove monken/tablesigniter composer require monken/tablesigniter==1.2.0

Then check whether the content in the specified directory looks like the picture below.

擷取
germs2611 commented 3 years ago

Hi @monkenWu am getting the below error when trying to reinstall with specific version.

image

monkenWu commented 3 years ago

@germs2611

What's your PHP version?

germs2611 commented 3 years ago

Hi @monkenWu PHP version is 8.0.3

germs2611 commented 3 years ago

Its seems like composer was using some old version of PHP. I ran it again with the --ignore-platform-reqs option and it works.

monkenWu commented 3 years ago

@germs2611 @1m-Arthur @404Nekorara Hi, this problem is caused because Tablesigniter only supports PHP7. The new version V1.2.1 starts to support PHP 8.0, you can directly use composer require monken/tablesigniter to install Tablesigniter.