This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TokenGenerator | |
{ | |
private const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
public function getRandomSecureToken(int $length): string | |
{ | |
$maxNumber = strlen(self::ALPHABET); | |
$token = ''; | |
for ($i = 0; $i < $length; $i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mailer | |
{ | |
/** | |
* @var \Swift_Mailer | |
*/ | |
private $mailer; | |
/** | |
* @var \Twig_Environment | |
*/ | |
private $twig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"reset-db": [ | |
"php bin/console doctrine:schema:drop --force; php bin/console doctrine:schema:create; php bin/console hautelook:fixtures:load -n;" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure xdebug | |
RUN echo $'error_reporting=E_ALL \n\ | |
display_startup_errors=On \n\ | |
display_errors=On \n\ | |
xdebug.remote_enable=1 \n\ | |
xdebug.remote_connect_back=1\n\ | |
xdebug.idekey=PHPSTORM \n\ | |
xdebug.remote_autostart=0 \n\ | |
xdebug.remote_port=5902' >> /etc/php.d/15-xdebug.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
db: | |
image: mysql:5.7 | |
ports: | |
- "3306:3306" | |
volumes: | |
- ./mysqldata:/var/lib/mysql:rw,delegated | |
environment: | |
MYSQL_ROOT_PASSWORD: "root" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\EventListener; | |
use Doctrine\ORM\Event\LifecycleEventArgs; | |
use App\Entity\User; | |
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; | |
class PasswordHashListener | |
{ | |
private $passwordEncoder; | |
public function __construct(UserPasswordEncoderInterface $passwordEncoder) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cerate your bash aliases | |
gedit ~/.bashrc | |
update it | |
source ~/.bashrc | |
# docker-compose | |
alias dcu='docker-compose up --d' | |
alias dcub='docker-compose up --build' | |
alias dcd='docker-compose down' | |
alias dcb='docker-compose build' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create column auto update timestamp: | |
CREATE TABLE comments2 ( | |
content VARCHAR(100), | |
changed_at TIMESTAMP DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP | |
); | |
Date Math: | |
SELECT birthdt, birthdt + INTERVAL 15 MONTH + INTERVAL 10 HOUR FROM people; | |
Date Format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMAGES : | |
<?php<?php | |
trytry { { | |
//// Create a new SimpleImage object Create | |
$image = new \claviska\SimpleImage(); | |
// Magic! ✨ | |
$image | |
->fromFile('image.jpg') // load image.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://getcomposer.org/doc/articles/versions.md#writing-version-constraints | |
1.0 - 2.0 is equivalent to >=1.0.0 <2.1 | |
~1.2 is equivalent to >=1.2 <2.0.0, while ~1.2.3 is equivalent to >=1.2.3 <1.3.0 | |
^1.2.3 is equivalent to >=1.2.3 <2.0.0 as none of the releases until 2.0 should break backwards compatibility. | |
pre-1.0 versions it also acts with safety in mind and treats ^0.3 as >=0.3.0 <0.4.0 | |
1.2.3 =1.2.3.0-stable | |
>1.2 >1.2.0.0-stable |
OlderNewer