// Create a request object or parse the URL
$request = \Symfony\Component\HttpFoundation\Request::create($urlWithoutToken);
// or get the current request.
// $request = $event->getRequest();
This file contains hidden or 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
-- Top 10 largest tables in a MySQL database | |
-- MySQL 5.7.29 | |
SELECT | |
table_schema AS `Database`, | |
table_name AS `Table`, | |
ROUND((data_length + index_length) / 1024 / 1024, 2) AS `Size (MB)`, | |
ROUND(data_length / 1024 / 1024, 2) AS `Data Size (MB)`, | |
ROUND(index_length / 1024 / 1024, 2) AS `Index Size (MB)`, | |
table_rows as 'Rows' |
This file contains hidden or 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 | |
declare(strict_types=1); | |
function simpleGenerator() { | |
echo "The generator begins\n"; | |
for ($i = 0; $i < 3; ++$i) { | |
yield $i; | |
echo "Yielded $i\n"; |
This file contains hidden or 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 | |
use Drupal\Core\File\FileSystemInterface; | |
$directory = '/path/to/processed'; | |
\Drupal::service('file_system') | |
->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY); | |
\Drupal::service('file_system') |
To extend the standard user registration form, use
namespace Drupal\your_module\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\user\RegisterForm;
class YourRegisterForm extends RegisterForm {
public function buildForm(array $form, FormStateInterface $form_state) {
We are going to replace "Make it at least 8 characters" from the user
core modules (core/modules/user/user.module
) with "Make it at least 12 characters".
/**
* Implements hook_element_info_alter().
*/
function <your_module>_element_info_alter(array &$types): void
{
if (isset($types['password_confirm'])) {
$types['password_confirm']['#process'][] = 'users_form_process_password_confirm';
ngrok creates a tunnel from the public internet to your local machine.
Sign up for an ngrok account https://dashboard.ngrok.com/
brew install ngrok/ngrok/ngrok
NewerOlder