Hits: 43
wget -O phpstan.phar https://github.com/phpstan/phpstan/raw/master/phpstan.phar chmod a+x phpstan.phar sudo mv phpstan.phar /usr/local/bin/phpstan phpstan
Developer, Maker.
Hits: 43
wget -O phpstan.phar https://github.com/phpstan/phpstan/raw/master/phpstan.phar chmod a+x phpstan.phar sudo mv phpstan.phar /usr/local/bin/phpstan phpstan
Hits: 7383
FROM php:8.1.1-apache RUN echo "Europe/Berlin" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata ENV APACHE_DOCUMENT_ROOT /var/www/html/web RUN apt-get update && apt-get install -y ca-certificates gnupg RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - RUN apt-get update && apt-get upgrade -y && apt-get install -y git nodejs RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf RUN /usr/sbin/a2enmod rewrite && /usr/sbin/a2enmod headers && /usr/sbin/a2enmod expires RUN apt-get update && apt-get install -y libzip-dev zip && docker-php-ext-install zip RUN docker-php-ext-install pdo pdo_mysql mysqli RUN apt-get install -y libtidy-dev && docker-php-ext-install tidy && docker-php-ext-enable tidy RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN pecl install xdebug && docker-php-ext-enable xdebug RUN echo 'zend_extension=xdebug' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.mode=develop,debug' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.client_host=host.docker.internal' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.start_with_request=yes' >> /usr/local/etc/php/php.ini RUN echo 'session.save_path = "/tmp"' >> /usr/local/etc/php/php.ini
Hits: 291
We can install Xdebug via pecl on MacOS with Homebrew. Paste that in terminal.
pecl install xdebug
And see if the php interpreter with Xdebug working:
d8devs@MBP-von-d8devs project % php -v PHP 8.0.8 (cli) (built: Jul 12 2021 02:58:53) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.8, Copyright (c) Zend Technologies with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies
to correctly configuration Xdebug, locate (or create) section in php.ini file. Finding your currently php.ini location, type this in terminal: php --ini
Open the php.ini file.
vim /opt/homebrew/etc/php/8.0/php.ini
add it as follows at the last lines of file
; List of h.... ..... ... xdebug.mode = debug xdebug.client = 127.0.0.1 xdebug.idekey = PHPSTORM xdebug.start_with_request = yes
Enjoy! 😊
Hits: 24130
Install first homebrew, if it is not already installed. Paste that in macOS Terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
And follow the ==> Next steps: after Installation add homebrew to your PATH
Actually Default Image for php from Brew Package Repository is a PHP 8. Here we can see that:
Thats means, we can simple install the php 8 in a macOS Terminal with this command brew install php, but we want to explicit install version 8, other versions can be declared as standard in the future. Paste that in terminal
brew install php@8.0
after that, you should be linked the installed php as system default php interpreter, for that run this command in terminal
brew link php
after restarting terminal, you must be see this output
d8devs@MBP-von-d8dev ~ % php -v PHP 8.0.8 (cli) (built: Jul 12 2021 02:58:53) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.8, Copyright (c) Zend Technologies with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies
Enjoy 😉
Hits: 209
<?php class CsvReader { protected $file; public function __construct($filePath) { $this->file = fopen($filePath, 'r'); } public function rows() { while (!feof($this->file)) { $row = fgetcsv($this->file, 4096); yield $row; } } } $csv = new CsvReader('/path/to/big/csv/file.csv'); foreach ($csv->rows() as $row) { // the CSV row. }