I am new to using composer, I have it installed, created composer.json file. Installed bigcommerce api using these instructions: https://github.com/bigcommerce/bigcommerce-api-php
When I try to run "use Bigcommerce\Api\Client as Bigcommerce" I am getting error class not found.
I am using localhost and my file structure is:
testsite
src-> contains all classes including Client.php
vendor -> bigcommerce -> api -> the api files,
api.php -> my test file trying to connect to api
I have not changed any composer files, I have looked into autoloading. As I said before it is first time using composer.
Please read the documentation of Composer here: https://getcomposer.org/doc/00-intro.md Pay attention to the last couple of paragraphs, "Using Composer" and "Autoloading". Did you follow the procedures in your code?
Related
After installing the API platform on my Symfony 6.2 project using the composer command composer require API
I can't find the api_platform.yaml file in config/packages folders, the only file related to API-PLATFORM I found is on the routes directory
Is this a new update? Or should I add it in a certain way?
Go to
config/packages/
Create
api_platform.yaml
Add your configuration
api_platform:
title: 'MY API'
Restart the Symfony Dev Server
symfony server:stop
symfony server:start
Check https://localhost:8000/api/docs to see the results.
I tried installing this composer module on my Laravel app https://github.com/alihesari/laravel-social-auto-posting but im facing some issues. Im avoiding composer since it requires me to update my Laravel version which will break things (im runnin under 5.1.9).
Steps that I took so far:
1) wget https://github.com/alihesari/laravel-social-auto-posting/archive/master.zip - inside htdocs directory
2) unzipped master.zip and renamed folders. Moved folders inside /vendor/ folder under this structure:
/vendor/toolkito/larasap/ - This folder contains the src subfolder as shown in the repo.
3) Added this reference in \vendor\composer\autoload_namespaces.php and in \vendor\composer\autoload_psr4.php: 'Toolkito\\Larasap' => array($vendorDir . '/toolkito/larasap/src'),
4) Configured my secret keys in the config file, for the proper social media connection
5) Added use Toolkito\Larasap\SendTo; in the main controller, as per repo's instructions
6) Added SendTo::Twitter('Hello, I\'m testing Laravel social auto posting'); to a function that I use and ended up in this error:
FatalThrowableError in HomeController.php line 47:
Fatal error: Class 'Toolkito\Larasap\SendTo' not found
I also tried use Vendor\Toolkito\Larasap\SendTo; in step 5, and ended up with the same error message.
Any suggestions please?
I created a fresh Laravel project v5.8. Then installed the latest version of the Laravel Code Generator (2.3) but I'm unable to generate resources. I've read your release notes for 2.3 and I'm not seeing where I'm making a mistake on the installation or the commands I keep the output below:
php artisan create:scaffold Test generates the output below:
Exception : The file
resources/laravel-code-generator/sources/tests.json was not found!
at /Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Models/Resource.php:686
682| {
683| $fileFullname = Config::getResourceFilePath($filename);
684|
685| if (!File::exists($fileFullname)) {
> 686| throw new Exception('The file ' . $fileFullname . ' was not found!');
687| }
688|
689| return File::get($fileFullname);
690| }
Exception trace:
1 CrestApps\CodeGenerator\Models\Resource::jsonFileContent("tests.json")
/Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Models/Resource.php:549
2 CrestApps\CodeGenerator\Models\Resource::fromFile("tests.json", "CrestApps")
/Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Commands/Framework/CreateScaffoldCommand.php:70
Please use the argument -v to see more details.
I'm getting a similar output when trying to create resources from a database table. I'm using the php artisan resource-file:from-database [model-name] command.
I read online that it may have to do with the Laravel storage folder not having the correct permissions but I've tried that and it didn't work. Cleared and config the cache, composer dump-autoload, etc... But nothing has worked.
I'm also noticing that the generator does not publish the configuration file on your sample video on your website. I have tried to publish the config file using the vendor:publish command but it generates a somewhat empty file, only has this option: 'files_upload_path' => 'uploads'. The folder for the generator located inside the resources folder does not contain a config file.
How can I fix this alert in PhpStorm?
And also how to get autocompletion for Route and other Facades?
Check the Laracasts walkthrough
1) Go to: https://github.com/barryvdh/laravel-ide-helper
2) Click on the gist
Generated version for L5: https://gist.github.com/barryvdh/5227822
3) Click on "Raw" to get the current version (as of June 22, 2016 it is):
https://gist.githubusercontent.com/barryvdh/5227822/raw/4d4b0ca26055fa4753b38edeb94fad2396c497c0/_ide_helper.php
4) Make sure you're in your root directory (this is mine)
cd /var/www/html/project
5) Download the gist:
wget https://gist.githubusercontent.com/barryvdh/5227822/raw/4d4b0ca26055fa4753b38edeb94fad2396c497c0/_ide_helper.php
6) Add "_ide_helper.php" to the .gitignore file
sudo nano .gitignore
Add "_ide_helper.php" on a new line at the bottom
7) Download the .gitignore and _ide_helper.php files into PhpStorm
This is what my PhpStorm project directory looks like afterwards:
8) After the files are downloaded into PhpStorm, the "Undefined class" error will disappear and autocompletion will now work. Might need to restart it.
There is greate IDE support for Laravel shipped from Baryvdh:
https://github.com/barryvdh/laravel-ide-helper
after you install it you just call in the console:
php artisan ide-helper:generate
which generate alll facede shortcuts in _ide_helper.php file (which you have to exclude from git)
There is also something special for PhpStorm:
php artisan ide-helper:meta
which will give Laravel container context for example:
$foo = app(Foo::class);
PhpStorm will know that the $foo variable is type of Foo class.
I know this is an old thread, but it is still relevant. For me, I decided to add the following to my routes/web.php since I don't want to have to worry about regenerating meta data for the app.
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
Edit: The above does not add any overhead to PHP as the use simply acts as a reference for PHP.
I solved this problem simply by installing the Laravel idea plugin.
Use the following link:
https://laravel-idea.com/
You can install it on your phpstorm.
Its good feature is that you can use it for 30 days for free and pay the amount after satisfaction.
Tried to implement Monolog into a CodeIgniter 3 base installation, and implemented as per the instructions here: https://github.com/stevethomas/codeigniter-monolog, but for some reason CI 3 does not replace the built-in system CI_Log library. I have done the following:
Installed Monolog via Composer.
Copied monolog.php and Log.php as per instructions to config and libraries respectively.
Added the Composer autoload instruction to my CI index.php file; the autoloader is being called, but the library is not initialized.
Expected result: Use Monolog instead of native CI logging.
Result observed: CI used built in CI logging.
What am I missing?
See http://www.codeigniter.com/user_guide/general/core_classes.html#replacing-core-classes
You must put it in application/core directory.
And about Composer autoloader. CI 3 has its config $config['composer_autoload'].
See http://www.codeigniter.com/user_guide/general/autoloader.html