Deploying my Laravel 7 app in Heroku I get this error, it appears only in Heroku, not on my local box (localhost)
Class 'NumberFormatter' not found (View: ...)
Server Details:
Heroku
PHP 7.4.12
Laravel Framework 7.30.4
The NumberFormatter classDocs requires the PHP Internationalization extension (intl)Docs, and this extension is not available built-in on Heroku Heroku Built-in ExtensionsHeroku Docs.
Instead Heroku gives you permission to use optional extensionsHeroku Docs.
To make use of them you can either use the composer command to require it ("ext-intl"):
composer require ext-intl
Or you can manually add this to composer.json in the require sectionComposer Docs:
{
"require": {
"ext-intl": "*"
}
}
Commit the file and push the changes to Heroku. The error should be gone until you find the next missing class.
This is another example, why it is a good idea if you have a Composer based PHP project, to document the extensions in use as well in the composer.json file.
When the day comes, you have them documented in the Composer JSON already.
And systems like Heroku can benefit from it, too!
Related
I transferred my cakephp api from linux vps to azure cloud. I configured redirects too but I am getting "Trait 'Crud\Controller\ControllerTrait' not found" error. I checked the bootstrap.php file to check whether its loading crud plugin or not. It does.
Do I need to run composer autoload to load the plugin? If yes then how to in azure as its windows vm.
Frist, you should check whether the folder named friendsofcake exists in \vendor directory or not. If not, you need to run the following command to install it by using composer:
composer require friendsofcake/crud:^4.3
Refer to this doc for more details.
I realised that my code base was created using composer version 1.
and to install all packages I had to run
composer install
However, not all plugins where loaded correctly. If you have composer version 2
installed and facing the issues
kindly run
composer update
I am looking to implement the framework amphp/thread, with Symfony3, which I ve read about in this article (https://www.mullie.eu/parallel-processing-multi-tasking-php/).
I'd looked at the setting process on the git page: https://github.com/amphp/thread.
I've followed the checklist:
PHP5.5+ = OK Php 5.5.12
pecl/pthread = OK I did install it as explained on Windows8
Now, 3rd task on the checklist, I have the installation of the framework itself (amphp/thread) left to do.
I am a bit confuse, because it is not an "official" Symfony bundle. So I don't think I can put it under [my_symfony_project]/vendor/ and refer to it in the file [my_symfony_project]/app/AppKernel.php. So how do one do in this case:
Do one put the directory of the library under the root directory [my_symfony_project]?
And afterwards, how can one refer to it in the Symphony class/file, should I write: "use amphp/thread" between the namespace declaration of my Symfony file and the class code itself?
You can simply install the library with composer, as example launching this command from the root of your project:
>php composer.phar require amphp/thread
And use it in your code directly: the composer process generate the correct autoloader for you. No necessary add to the list of the Symfony2 bundle (is not a bundle).
Hope this help
You will need to install the package by adding the following to your composer.json file:
"require": {
"amphp/thread": "0.8.1"
}
Then run "composer install" on your server.
I am Using my own Machine Kali Linux 2.0 Debian x64 . Now, i have Installed Laravel in my directory structure like
/opt/lampp/htdocs/learning-larvel/
Inside the Learning-laravel folder i have Installed my Laravel files, and also i installed composer. So when i go to http://127.0.0.1/learning-laravel/public . I see a See a White Screen and in Between it is written "Laravel 5", which means the Laravel GUI Setup is fine.
Now, to create a new file for Laravel, when i open my Terminal and type
laravel new xyz
then it gives me a error which says bash: laravel: command not found
Now, how can i fix the error.. I have researched about it by setting PATH to bashrc. But i am not getting it fixed right. Additionally when i type in my command composer -version then also it says bash: composer: command not found but i have Installed composer on the folder learning-laravel itself.
I could also see files like composer.phar there in /opt/lampp/htdocs/learning-larvel/
Any help would be extremely thankful.
As the composer official getting started page points out:
There are in short, two ways to install Composer. Locally as part of
your project, or globally as a system wide executable.
if you wanna do composer -- or laravel -- in command line, you wanna install them globally.
Check out the following links:
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
https://laravel.com/docs/4.2#install-laravel
I encountered the same problem. Apparently, the composer exists in path ~/.config/composer/vendor/bin when running as super user. Therefore, replacing the paths which were described above by this, and it should work. Hope it helps.
I need to install CakePHP 3 in an old-fashioned upload-unzip-run way.
The archive I've downloaded from cakephp/cakephp/tags does not contain the default folders like webroot, Model etc., which means it's not complete.
The official documentation does not cover this. Here's a relevant Github issue I found, but the person ends up still using Composer.
There's also cakephp/app and it seems to include those missing files, but it's not mentioned in cakephp/cakephp's composer.json, and even if I download it I've no idea how to merge the packages.
Packaged app (cakephp/app) releases that include all dependencies (framework (cakephp/cakephp), standard CakePHP plugins (cakephp/debugkit, cakephp/bake, etc), required third party libraries) can be found on GitHub.
https://github.com/cakephp/cakephp/releases
It's the download with the small package symbol, named like cake-3-x-x.zip.
However, it isn't a good idea to ditch the dependency manager, as keeping the code base and the autoloader up to date will be rather tedious, and, no offense, I have my doubts that you'll be able to handle this properly if you don't even know how to stitch the app and cake packages together.
You can install CakePhp 3 without Composer.
You need minimum requirements to install CakePhp 3 and CakePhp 3 boilerplate ( fresh copy of Cakephp 3 ).
You can download CakePhp 3 boilerplate from github.
Requirements
Server
HTTP Server. For example: Apache. Having mod_rewrite is preferred,but by no means required.
PHP 5.4.16 or greater.
mbstring extension
intl extension
Database :
MySQL (5.1.10 or greater)
PostgreSQL
Microsoft SQL Server (2008 or higher)
SQLite 3
All built-in drivers require PDO. You should make sure you have the correct PDO extensions installed.
CakePhp 3 Boilerplate:
Repository Home
https://github.com/cakephp/cakephp/releases
CakePhp 3.1.4
https://github.com/cakephp/cakephp/releases/download/3.1.4/cakephp-3-1-4.zip
CakePhp 3.0.15
https://github.com/cakephp/cakephp/releases/download/3.0.15/cakephp-3-0-15.zip
Download one repository and unzip where you wanted to install it.
You may get one error like ( you may not get error if you are lucky!)
Fatal Error
Cake\Error\FatalErrorException
Error: Class 'Cake\Mailer\Email' not found
File D:\xampp\htdocs\practice\cakephp\cakephp-3-1-4\config\bootstrap.php
Line: 138
Then you have to comment two line in config/bootstrap.php
//Email::configTransport(Configure::consume('EmailTransport'));
//Email::config(Configure::consume('Email'));
And finally you got CakePhp 3 installed.
[I am also new in CakePhp 3.So Please inform me if there are any wrong in my given process.]
Thanks
Use Composer.
Install Composer locally, follow the Cake installation instructions, then upload the created folders to the target webhost.
Easy, For CakePHP 3.x you can just download the release you want from here
https://github.com/cakephp/cakephp/releases (eg. https://github.com/cakephp/cakephp/releases/tag/3.3.16).
For a complete installation select the first download link (.zip)
the other links are just for the src
Just run this command to get a clone of CakePHP 3.10.0
git clone -b 3.x git://github.com/cakephp/cakephp.git
Try simple steps
1. Download XAMPP Server.
2. Install XAMPP server.
3. Go to ..\xampp\php\php.ini and open.
4. Add this line (extension=php_intl.dll) or if exist uncomment.
5. Download Composer setup from https://github.com/composer/windows-setup/releases/
6. Install composer and give php.exe file in path
7. Open cmd and check now php version using command php -v. if its showing php version its means its working.
8. Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
9. Finished folder created in htdocs.
I'm new to Composer and in my current project I would like to install a bunch of PHP libraries like:
Doctrine
Security Library (Which i have no idea but looking for in CodeIgniter)
Bootstrap layout libraries and other when necessary
For that matter , I would like to use Composer based library management in my application,
and i get confused that if i have to include composer.phar on my project directory or not.
since i have it on my environment path and I can run Composer form command line .
How can integrate the above libraries into my codeigniter application then..
Appreciate your toughs!
The composer.phar file is an executable and it should not be committed. What it actually does is that it looks in your composer.json file and there you can declare some more dependencies (libraries for example) and their version:
{
"require": {
"doctrine/orm": "*"
}
}
The version in this case is declared with "*" so Composer will get the latest version. This is very useful if there are more people on the project, to make sure all of them have the same version of dependencies installed (so the composer.json file must be committed).
If you run "composer.phar update" on the other hand, this will get the latest version of all dependencies, no matter the version placed in composer.json and updates the lock file with the new versions.