I was developing REST API's in Laravel5 and now I am moving same project to Lumen due to speed issue.
The problem is,I am using "vsmoraes/laravel-pdf": "1.0.1" in Laravel,Now I want to use the same in Lumen.
How it is possible?
When I am added via composer and trying to access from controller,I am getting following error ,
BindingResolutionException in Container.php line 785:
Target [Vsmoraes\Pdf\Pdf] is not instantiable.
Any idea?
Lumen is a micro-framework based on Laravel. As of that, Lumen does not have all the Laravel featuers (by default).
Most of the packages will have to be updated, so they will have much less Laravel-specific dependencies than they're having now.
Related
I'm currently developing a set of packages/service providers to use as a sort of boilerplate for new web applications. I started developing some time ago and I never ran the packages through composer.
After I made a repository and added the package to a new Laravel application, it installed just fine, until it ran php artisan package:discover. The error was:
In breadcrumbs.php line 5:
Class 'Athena' not found
and it refers to this line:
Breadcrumbs::register( \Athena::getFacadeRoot()->route_name_prefix . '.dashboard.show', function ( $breadcrumbs ) {
in which \Athena:: is a facade within the package. I fixed the issue by adding the facade to the app.php file. The idea was to bootstrap applications easily, so my question is:
Can I use a facade within a package and still use the Laravel package discovery, without having to edit files when I create a new project?
I am in the process of learning Laravel, currently, I have a Template/Framework installed on the server and it uses the Illuminate framework? I have read that Laravel has depreciated that package with Laravel.
What is the process of updating an existing template from Illuminate to the more current Collective HTML?
When I try it breaks the pages existing. I have tried the following but it does not seem to help.
Switching from Illuminate\Html to Collective\Html, Class 'Illuminate\Html\HtmlServiceProvider' not found
I solved this by removing a duplicate Illuminate statement in the config/app.php as hinted at by Rob Fonseca.
A colleague of mine is having an issue trying to get a Lumen module working for Codeception. He has added some notes here:
https://laracasts.com/discuss/channels/lumen/codeception-lumen-module
He is trying to create a Lumen module for Codeception based on the Laravel5 module, without success. Laravel implements an HttpKernel but Lumen does not, it appears that the http kernel translates Laravel's requests for codeception tests, so attempting to run the tests without initializing the http kernel doesn't work.
It may be the case that we need to use the Symfony Http\Kernel rather than the Laravel one, in which case how do we initialize that kernel module from codeception?
Has anyone else done any work towards getting Codeception tests running with Lumen?
I've forked that current project and I believe I may have a working copy of this package.
https://github.com/jerairrest/codeception-lumen
Take a gander. I've also put in for a pull request but I haven't got a response from the original maintainer.
Cheers!
Jer
I am receiving the following error when using paginate with Eloquent:
Argument 2 passed to Illuminate\Pagination\Factory::__construct() must be an instance of Illuminate\View\Factory, instance of Illuminate\View\Environment given, called in C:\****\vendor\laravel\framework\src\Illuminate\Pagination\PaginationServiceProvider.php on line 23 and defined
For testing purposes, this is all I have in the method of my controller:
return User::paginate(15);
I'm aware about the upgrade procedure from the docs, but I don't have any of the references mentioned there.
Update:
In my specific case there was a package in the workbench which was requiring Illuminate 4.1 components, I changed to 4.2 in composer.json, removed the vendor dir and composer.lock file, did a composer install, and the error is gone.
These operations were all done within the package folder.
Posted as a comment, but it was the right answer:
Is there any chance you are only requiring some of the Laravel components, and not the entire Laravel framework? If you are only working with some then things like this can get out of whack, especially if not all of your components are updated to 4.2.
I encountered the same issue as you when I updated from 4.1 to 4.2, which in my case I did a composer update on my development environment before pushing and did a pull from my staging. Now the pagination issue doesn't exist in my development but in my staging, so I figured it might be the issue with git pull missed some files, or cache in the views. So I did remove the entire project and do a clean clone from the repository, that seems to fix the problem.
So not fully sure on how you update, but you might want to check that your updated files has been fully applied.
I also ran into this same problem when upgrading from 4.1 to 4.2, but my fix was different to Phil Sturgeon's.
I simply had to remove the bootstrap/compiled.php file located in the root of the Laravel project.
I am trying to have a type=xml/json on the response of my API.
I am using the laravel 4 framework and I was trying to look for such library.
I found jmsyst.com/libs/serializer but I cant make it work for laravel so I continued to look for another that can be easily added to laravel 4, So I finally found github.com/SoapBox/laravel-formatter.
I installed it into laravel with composer as "hitsend/laravel-formatter": "dev-master"
All went well and I went ahead to add the provider on the config/app.php
'SoapBox\Formatter\FormatterServiceProvider',
But laravel now returns the error:
Class 'SoapBox\Formatter\FormatterServiceProvider' not found
I tried to check my autoload_namespaces.php and saw that hitsend is there.
Why is it not detected the provider?