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.
Related
I am developing some composer php library.
And I want to provide library users to use class that uses some external package. I suggest this package in the relevant composer section.
Should I check that the composer's suggested package is really installed?
Will there be an error if the user just install my library without suggestions, but will not use this class that dependent from not installed package?
I checked some popular packages and seems to be they just use suggested packages as if they are already installed.
For example: https://github.com/Seldaek/monolog/blob/c861fcba2ca29404dc9e617eedd9eff4616986b8/src/Monolog/Handler/ElasticsearchHandler.php
This monolog class just uses Elasticsearch classes as usual, but Elasticsearch is a suggested package and may be not installed.
The handlers use the other packages as if they were installed - but keep in mind that Monolog does not use each and every handler automatically. If you define that such a handler (in your example: the one for ElasticSearch) is used, it is up to the user to know how to handle this.
As you can see in the constructor of that method, it is not even instantiable if you don't have a package for ElasticSearch installed - the code example in that class helps to understand this situation. So, no, this class is not usable without having another package installed, but the error will be thrown by your classloader. No need for the package to check for this
I want to install phpoffice/phpexcel in My Project.
When composer install or composer update, i receive error:
Package phpoffice/phpexcel is abandoned, you should avoid using it.
Use phpoffice/phpspreadsheet instead.
What is wrong with my project? Please help me. My project use PHP version 7.1.3 and Laravel version 5.7
It means the project is not being maintained. you can still use if you want to.
That message you are getting is just a warning, not an error so there is nothing wrong with your project. So you could ignore the warning and continue using the package with your current code.
However, as the message said you should avoid using it because the package might stop working properly if you decide to update laravel, php or any other dependencies. And if it does stop working or you encountered a bug, there will no code maintainer to help you solve your issue.
In your case, phpoffice/phpspreadsheet package actually provide a useful entry in their documentation to help you migrate to their package, so you should definitely give it a read as there are quite a few breaking changes if you decide to use their package.
I want to install this package in my project
https://github.com/spatie/laravel-sitemap
but the installation's failed. the error is
Anyone encountered this error. or their have other better package for laravel sitemap? any tutorial? thanks everyone :)
The error message is pretty clear. You're trying to install spatie/laravel-sitemap:^3.3, which requires laravel/framework:5.5 or higher. So you need to either upgrade to use Laravel 5.5, or use an older version of spatie/laravel-sitemap.
The Github repository lists the available releases. I would suggest looking at v2.4 as a starting point, as the ChangeLog for v3.0 mentions about adding Laravel 5.5 support.
composer require spatie/laravel-sitemap:2.4
Edit:
You asked where to put the generator code. It isn't something you're going to want to run on every request, so I would suggest creating a route dedicated to creating the sitemap.
// routes/web.php
Route::get('sitemap/generate', function () {
SitemapGenerator::create(base_url())->writeToFile($path);
});
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.
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.