Using an old PEAR package on Laravel - php

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.

Related

Laravel package installation without composer

How can I manually configure the laravel package without composer. I have a project in which I got error when installing Intervention package. Please suggest me Is it possible or not.
While you definitely can, for instance, simply clone their GitHub repo, eg.:
git clone https://github.com/Intervention/image.git
And then manually include corresponding files (classes) in your code, I wouldn't recommend it - composer generates autoload files, but this package will be ignored since it's not in composer.json. You will end up adding manual require()s somewhere in your code.
I would say try to fix your composer package issue first, and only if it cannot be helped - download and include Intervention manually

Symfony - manually add phpxmlrpc to vendor

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.

Including laravel 5 packages in lumen

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.

how to use wepay PHP sdk in laravel 5?

I want to use wepay PHP sdk in laravel 5 using composer but I didn't found any laravel package for it.
Can you please tell me me how can I do this?
The package is available via packagist.org - unfortunately only as a dev-master branch and with suboptimal autoloading configured (I'm trying to fix that, sent both a patch and opened an issue suggesting they tag their version).
Adding that package is basic Composer action. The classes should be automatically available within Laravel wherever you think you want to use it.

Laravel module autoload policy confusion

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.

Categories