This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

frederico.rodrigues3443
frederico.rodrigues3443

Hi, i need install PHPExcel inside my plugin and setup composer.jon with: ...

"require": {

    "php": ">=5.4",
     "phpoffice/phpexcel": "*"
},
"autoload": {
        "classmap": [
        ""
    ]
},
"extra": {
    "branch-alias": {
        "dev-master": "1.0-dev"
    }
}

... Then i run the following command:

composer update composer dump-autoload

this run with success and generate a folder vendor inside plugin with the libraries.

The problem is when i try to use the class PHPExcel i have 'class not found'

the call:

$obj= new \PHPExcel();

can anyone help me?

Last updated

that0n3guy
that0n3guy

You may need some kind of use on at the top of your class. I've not used that class.

As an alternative, I know https://github.com/Maatwebsite/Laravel-Excel is very good. I've used it many times, and its built for laravel.

pwtan14262
pwtan14262

Hi,

i'm a noob in october cms. Based on the link https://github.com/Maatwebsite/Laravel-Excel, where do i add and update "maatwebsite/excel": "~2.1.0". There seems to be many composer.json in october cms. Which composer.json should i update. Thanks

uXMs
uXMs

@pwtan14262 you should create a composer.json file in your plugin's root folder. Do not change other composer.json files because they will probably overridden on next update..

pwtan14262
pwtan14262

Hi uXMs, After following the instructions in https://github.com/Maatwebsite/Laravel-Excel, i got the following errors.

PHP Fatal error: Class 'Maatwebsite\Excel\ExcelServiceProvider' not found in /var/www/html/install-master/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 150

Just to check, when the document say to add ServiceProvider to the providers array in config/app.php, the config file is refering to the one in the same directory as Plugins, storage, vendor, etc.?

Thanks in advance.

uXMs
uXMs

You should run composer update in your plugin directory. October do not know if your own plugin has composer dependencies or not.

Then add service provider to your plugin's boot method:

    public function boot()
    {
        App::register('\Maatwebsite\Excel\ExcelServiceProvider');

        // Register aliases
        $alias = AliasLoader::getInstance();
        $alias->alias('Excel', 'Maatwebsite\Excel\Facades\Excel');
    }

Take a look at debugbar plugin for sample of this process

pwtan14262
pwtan14262

Hi uXMs ,

Thank you so much for you help. I finally managed to get everything running. Thanks again.

frank16739
frank16739

Hi,

i'am new to october and have created some little plugins with success. Now i need this Excel export and have all setup correcly. Demo export with this sample http://ourcodeworld.com/articles/read/234/how-to-create-an-excel-file-using-php-office-in-laravel as xlsx has created successfull. Installation its ok i think. Now my question to the configuration publishing. Documentation says:

Laravel 5 To publish the config settings in Laravel 5 use:

php artisan vendor:publish This will add an excel.php config file to your config folder.

what's the solution to create this config file in october? Thanks for helping. Frank

Eoler
Eoler

frank16739 said: what's the solution to create this config file in october?

Probably the same - October is Laravel (5.1)

frank16739
frank16739

Hi Eoler,

thank's for your answer. After execute "php artisan vendor:publish" the config Files are copied to \config Folder in Root Application. is this ok? Can i tell october to use the config folder in Plugin Directory \plugins\author\pluginname\config ? Is this irrelevat?

additional information: vendor publish has copied config files from some other plugins who is installed from october plugin repository (flynsarmy/idehelper, renatio/dynamicpdf).

Renatio
Renatio

All config files are stored in root config folder. Some plugins in addition can register their own configuration. So after you ran php artisan vendor:publish you published configuration for all of them (it can be done to only selected one with paramater). Now you can change configuration files without touching external plugins/vendor source code, that's the whole idea.

Last updated

frank16739
frank16739

ok now i understand! Thx!

1-12 of 12

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.