Showing posts with label Composer. Show all posts
Showing posts with label Composer. Show all posts

Monday, January 9, 2023

Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

To get the current memory_limit value, run:
php -r "echo ini_get('memory_limit').PHP_EOL;"


Try increasing the limit in your php.ini file (ex. C:\xampp\php\php.ini for Windows-like systems):
; Use -1 for unlimited or define an explicit value like 2G
memory_limit = -1


Or, you can increase the limit with a command-line argument:
php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle

Monday, May 22, 2017

Install Composer as Portable on Windows

Its sometimes we need Composer in our system but we don't want to install another extra software in our machine. So below is a simple nice script to do it without any hassle. Just you need to create an file named "Composer-installer.bat" with content below in any of your directory and double click on it. It will install composer in your system.

@ECHO OFF
REM Installs Composer as portable

REM Set Home folder as Composer Global Configuration Folder
SET COMPOSER_HOME=%~dp0Home
if not exist %COMPOSER_HOME% md "%COMPOSER_HOME%"

REM If PHP Path Not Set Yet
set PATH=%PATH%;c:\xampp\php

REM Download Composer
php -r "readfile('https://getcomposer.org/installer');" | php

SET COMPOSER_BAT=%~dp0composer.bat
if not exist "%COMPOSER_BAT" (
 echo @ECHO OFF> "%COMPOSER_BAT%"
 echo SET COMPOSER_HOME=%%~dp0Home>> "%COMPOSER_BAT%"
 echo if not exist %%COMPOSER_HOME%% md "%%COMPOSER_HOME%%">> "%COMPOSER_BAT%"
 echo php "%%~dp0composer.phar" %%*>> "%COMPOSER_BAT%"
 echo EXIT /B %%ERRORLEVEL%%>> "%COMPOSER_BAT%"

)
call composer --version | findstr /i /r /c:"Composer......version"

REM Increases Composer Time-out
call composer --quiet config --global process-timeout 3000

REM Set Local folder for Composer Internal Cache
SET COMPOSER_LOCAL=%~dp0Local
if not exist %COMPOSER_LOCAL% md "%COMPOSER_LOCAL%"
call composer --quiet config --global cache-dir "%COMPOSER_LOCAL%"
pause

Thursday, April 20, 2017

How to remove a package from Laravel using composer?

Running the following command will remove the package from vendor (or wherever you install packages), composer.json and composer.lock. Change vendor/package appropriately.

It is important that you must remove all references from your project before execute the command below.

composer remove vendor/package

Thursday, November 3, 2016

How to install Laravel 5 with Xampp (Windows)

Requirements:
1. PHP 5.5.9 or above
2. OpenSSL PHP Extension
3. PDO PHP Extension
4. Mbstring PHP Extension
5. Tokenizer PHP Extension

First of all, we need Xampp, so we can download it from the official page

After you've downloaded and installed Xampp, we need to install Composer from official page

After install it, we can open a Windows terminal and write composer for execute the command:




We will configure a Virtual Host in Xampp for a Laravel project, and in this example, we want to configure the domain laravel.local for our project.
We need to edit httpd-vhosts.conf that is located in C:\xampp\apache\conf\extra\httpd-vhosts.conf and add following lines at the end of the file:


<VirtualHost laravel.local:80>
    DocumentRoot "C:\xampp\htdocs\laravel\public"
    ServerAdmin laravel.local
    <Directory "C:\xampp\htdocs\laravel">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Now we have to configure our hosts file that allows to redirect laravel.local to the localhost that is located in C:\Windows\System32\drivers\etc, add "127.0.0.1 laravel.local" to the  end of the file named "hosts".

We are prepared to install and configure a Laravel Framework. First of all, we have to navigate to "C:\xampp\htdocs" folder to install it and run this following command:


composer create-project laravel/laravel your_folder







Finally, have to start our Apache and MySql from Xampp control panel



And need to start laravel as server using following command:

php artisan serve --port=45

and navigate to http://localhost:45 from browser: