Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am using composer to install php packages. All packages are installed in Vendor folder. Some kind of package are easy to use in laravel but their are many php 3rd party package. Sometimes I need them to use in my laravel package.
My question is. How can I call php package from vendor folder to my laravel controller? If I can call them then I can use them. So I don't know how to call in laravel. But on my Row PHP project I can call them using autoloader.php But i don't understand how to call in laravel.
So please help me to use 3rd party php package/library in laravel.
If the package is inside the Vendor folder then in your controller function, call like this
$client = new \Package\Name\Class;
or
use Package\Name\Class;
$client = new Class;
Here is another reference
How can I use a class from vendor folder in laravel project
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last month.
Improve this question
I'm triying to create a new symfony project for class work and when I try to run the command to create it:
composer create-project symfony/skeleton:"^5.4" 2023-truiter-symfony
Gives me the next error:
symfony error
My PHP version is 8.1.12 and my composer version is 2.5.1
I've been trying to create a new symfony project without specifying the version and it works, but I would like that when the project is created it has the version ^5.4
Finally I have found a solution to the problem, I have installed CLI Symfony following the instructions from:
https://symfony.com/download
Once installed the problem when creating the project with the "^5.4" version has been solved.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to solve a kata using PHP and test driven development. I would like to use a generator or template to base on a minimal composer project with phpunit.
The minimal project should contain:
the composer.json with phpunit as require-dev
the vendor folder
a sample tests folder with a test file and a source file
I wondered how other developers do that in PHP and found so far the following options:
use PHPStorm and create a new composer project based on laravel/laravel followed by php artisan key:generate as described here and here
use composer init as described in this post
use php-pds/skeleton followed by composer require phpunit/phpunit --dev as described here
What is typical way for a PHP developer to deal with the initial boilerplate in a small php project?
I can offer you my approach as a reference:
I have a skeleton in PHP with composer and PHPUnit with a class and its test already set up. When I want to challenge a new kata, I just create a new kata and duplicate the skeleton in it (https://docs.github.com/en/free-pro-team#latest/github/creating-cloning-and-archiving-repositories/duplicating-a-repository), then updates readme and class names to reflect the kata. Usually, I use master as the reference for the kata to start, and each attempt is a new branch from master.
Here is the link to my repo as a reference, you can use it as a template :)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I just wanted to ask if anyone knows why the scaffolding section isn't available in Laravel 8.x.
Recently I've tried the php artisan ui react but it didn't work.
And when I've tried it with the 7.x it worked fine.
Is Laravel dropping the support for that in 8.x or is it an upcoming feature or it has been changed to another method, thank you in advance.
Link to the documentation page here
From laravel 6 to 7 upgrade notes: https://laravel.com/docs/7.x/upgrade
All authentication scaffolding has been moved to the laravel/ui repository. If you are using Laravel's authentication scaffolding, you should install the ^2.0 release of this package and the package should be installed in all environments. If you were previously including this package in the require-dev portion of your application's composer.json file, you should move it to the require section:
composer require laravel/ui "^2.0"
Did you run the command above before running php artisan ui?
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
In our company we currently do not use composer, we just download and store all libs under git.
What arguments can be given to our customers and system administrators to convince them of the need to use composer?
Our request must be substantiated enough to make a decision.
With Composer you get the following advantages:
The dependencies required by the package you are pulling in are automatically taken care by Composer itself, leaving you free to focus on the programming instead of dependency management.
When the package you are using gets a new version, a simple composer update will do everything for you without ever needing to do any file management manually.
With Composer you get a centralized autoload.php file which also be optimized for production. It loads everything you need and all you need to do is include one file. The optimized version is super fast! Simply do composer dump-autoload -o.
You can use psr-4 namespaces to load a specific path on your application and have it be included in the autoloader file. Then you can simply use the namespace and it's available application wide!
Look at the following URL for a more detailed list of features: https://getcomposer.org/doc/01-basic-usage.md
There are a lot more things you can do with Composer and it's wonderful. I highly advise that you guys use it and stop wasting time on managing packages yourself.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
How to work with non laravel packages as i want to use https://packagist.org/packages/kerphi/phpfreechat this packages
You can use the simple composer functionality. Via commandline run:
composer require kerphi/phpfreechat
That's it the package classes should now be available within your application.
You can view the complete documentation on loading packagist dependancies on the composer website.
update
You won't be able to use this package as the package requires the slim framework. You can see this on the package github page: https://github.com/kerphi/phpfreechat and the index file called during javascript usage: https://github.com/stmolivier/phpfreechat/blob/master/server/index.php
If you are using windows then In cmd go to your project location and run this code
composer require kerphi/phpfreechat