Posted on January 5, 2017, 9:40 am, by admin, under
php.
A Strategy pattern is an operational pattern. Strategy pattern allows you to polymorphically change behavior of a class. Strategy pattern is to avoid conditionals switching in favor of polymorphism. So, Strategy pattern = polymorphism. A Factory pattern is a creational pattern. Factory pattern allows you to encapsulate object creation. Factory pattern = encapsulation. A difference […]
Posted on November 7, 2016, 11:09 am, by admin, under
php.
Class names MUST be declared in StudlyCaps. Class constants MUST be declared in all UPPER_CASE with underscore separators. Method names MUST be declared in camelCase.
Posted on October 2, 2016, 10:30 pm, by admin, under
php.
<?php $transport = \Swift_SmtpTransport::newInstance(’smtp.gmail.com’,465) ->setUsername(’yourusername@yourdomain.com’) ->setPassword(’yourpassword’) ->setEncryption(’ssl’) ->setAuthMode(’login’); $mailer = \Swift_Mailer::newInstance($transport); $message = \Swift_Message::newInstance() ->setSubject(’Welcome’) ->setFrom(array(’yourusername@yourdomain.com’)) ->setTo(array(’to@to.com’)) ->setBody(’hello world’) ->setContentType("text/plain"); $mailer->send($message);
Posted on September 18, 2016, 10:43 pm, by admin, under
php.
1. A bootstrap (app/bootstrap.php) and application file (app/app.php) which could be used by my frontend controller, as well as by PHPUnit/Codeception 2. A web directory that is accessible for the world, containing only index.php and possibly some resources web/index.php
Posted on August 24, 2016, 8:51 am, by admin, under
php.
vendor/bin/php-cs-fixer fix path/to/folder –level="psr2" -v The –dry-run option displays the files that need to be fixed but without actually modifying them vendor/bin/php-cs-fixer fix path/to/file –level="psr2" –dry-run –diff -v
Posted on March 26, 2016, 9:45 pm, by admin, under
php.
<?php ini_set(’memory_limit’,’2048M’);
Posted on February 22, 2016, 10:49 pm, by admin, under
php,
yii.
<?php echo $query->createCommand()->sql;
Posted on February 11, 2016, 3:23 pm, by admin, under
php.
<?php curl_setopt($f1, CURLOPT_VERBOSE, true);
Posted on February 10, 2016, 9:47 am, by admin, under
php,
yii.
<?php return Yii::$app->response->sendFile($fileName);
Posted on December 18, 2015, 9:22 am, by admin, under
php.
apt-get install msmtp add gmail account to /etc/msmtp vi php.ini sendmail_path = "/usr/bin/msmtp –logfile /var/log/msmtp_php/msmtp-php-cli.log -a gmail -t"