Im currently trying to include illuminate/filesystem into lumen
So far I have managed to install the package running the following command:
composer require Illuminate/Filesystem
However I have no idea how to register the static class inside the application, I can't seem to find anything on the internet which talks about how to implement laravel 5 packages into lumen.
I have tried adding a class alias to the core of lumen, but this seems wrong to me.
There's nothing wrong with registering a class alias for the File facade, just don't do it in the framework source files (within the vendor directory). A good place to put that is inside the bootstrap/app.php file. Just add this and you're good to go:
class_alias('Illuminate\Support\Facades\File', 'File');
No additional packages need to be installed for this to work because Illuminate/Filesystem already comes with Lumen.
Related
I tried adding Recaptcha through the Anhskohbo package but there is the error of no class found.
This package comes with laravel framework in my case I was upgrading the framework so I replaced the file app/config.php to new version
and it work
It tells you that it does not exist because it does not really exist. I think that if you download it, it will't work. You may have to take the full version of laravel framework as it is
or create new project for same version and tack app/config.php to your project
or reinstall by after delete vendor
composer install
I'm trying to use this package on Laravel 5.1.x.
https://packagist.org/packages/pear/console_table
Doesn't seem to work out of the box because of the naming.
File name is Table.php and class name is Console_Table.
I was wondering if anyone has been able to successfully do something like this in the past?
ie. Make an old package work with Laravel
If you install a package via composer, you have to use the autoloader generated by composer. Using PEAR's require_once statements does not work with packagist packages.
I am trying to get my head around Composer. I want to integrate this package into my app: https://github.com/thiagoalessio/tesseract-ocr-for-php
I have done the following so far:
composer require thiagoalessio/tesseract_ocr
composer dump-autoload
and I have used the library within a Controller method as such:
$tesseract = new TesseractOCR($url);
But I'm getting the dreaded:
Class 'App\Http\Controllers\TesseractOCR' not found
How do I make sure that composer autoloads the package and that it is available throughout the apps, for usage within controllers?
Sorry, newbie in Composer here..
Composer has auto-loaded the package, you’re just referencing the class name incorrectly.
TesseractOCR lives in the “global” namespace, so you need to import it:
use TesseractOCR;
You can then use it in your controllers etc as normal.
I need to use XML-RPC on my project. I have found a library phpxmlrpc (http://phpxmlrpc.sourceforge.net/) and I need to add it to vendor. I have copied the files in vendor folder (/vendor/phpxmlrpc/) and I need to see the xmlrpc_client class in my Controller. But I am not able to manage how to edit autoload.php to see the class, after a few attemps I am still getting "Attempted to load class "xmlrpc_client" from the global namespace.
Did you forget a "use" statement?" so I am pretty sure that there is some mess in my structure. I would really appreciate any help.
You must use a composer install tools for integrate 3third party code in your project a lot of possible time.
For XML-RPC you have this bundle : Symfony-rpc-bundle
When you install with composer install your bundle a lot of tricks run in your project symfony. Don't forget to add this bundle in your AppKernel.php file.
With this your code for XML-RPC is more upkeeping and stable.
A bit late with the answer, I fear, but phpxmlrpc can now be installed using Composer as you would do with any other package.
When checking out info about that library, just make sure that you look up the latest version on GitHub and not any more on SourceForge.
When executing
php artisan workbench user/asset
additional dependency(module) placed to
workbench/user/asset/vendor/illuminate/support.
Then framework autoload this module(illuminate/support) from workbench/user/asset/vendor/*, but i think it must load it from /vendor/laravel/framework/src/Illuminate/
So we have confusion here - some classes are loaded from framework(vendor/laravel/*) and some classes are loaded from workbench/[vendor]/[module]. Is that supposed to work that way? Or is it a bug?
Yes and No.
During development of your package it will work that way, because the whole structure is inside /workbench. It also helps you working in different versions of packages, develop using Laravel 4.1 while your app is still on 4.0.
After you finish working on your package, it's better to create a real Composer package. You can create a private one and then, yeah, once you install it via Composer it will be placed in /vendor.