Acabo de crear como proyecto personal una lista de correo semanal con contenidos relacionados con PHP seleccionados manualmente por mi. Será una colección de noticias, tutoriales e información relevante sobre PHP y su ecosistema: Laravel, Symfony, WordPress, Drupal,… Si quieres apuntarte puedes hacerlo desde este enlace https://www.lasemanaphp.com
Tag: laravel
Limit one session per user in Laravel 5
Laravel 5 does not limit the number of sessions a user may have open, so the web application may be open in several browsers of several computers.
In a project in which I am participating we need that the user can only have an active session, so if it is authenticated in a browser, the rest of sessions have to disappear, so the user can not use the web application in the other browsers, except in the last one. The example is developed with Laravel 5.4.
Limitar a una sesión por usuario en Laravel 5
Laravel 5 no limita el número de sesiones que puede tener abiertas un usuario, por lo que puede tener abierta la aplicación web en varios navegadores de varios equipos.
En un proyecto en el que estoy participando necesitamos que el usuario solo pueda tener una sesión activa, con lo que si se autentifica en un navegador, el resto de sesiones tienen que desaparecer, con lo cual no podrá usar la aplicación web en el resto de navegadores, excepto en el último. El ejemplo está desarrollado con Laravel 5.4.
Error with composer installing a Laravel 5.5 application in a Debian 9 with PHP 7.0
Installing a new Laravel 5.5 application in a Debian 9 with PHP 7.0.27, when I execute the “composer install” I get this error:
How to show the Laravel version of a project?
If you want to show the Laravel version of a project, you can use the command:
$ php artisan --version Laravel Framework 5.5.32
This command gets the version from a constant in a file placed in the vendor\laravel\framework\src\Illuminate\Foundation\Application.php file
class Application extends Container implements ApplicationContract, HttpKernelInterface { /** * The Laravel framework version. * * @var string */ const VERSION = '5.5.32';
How to install composer globally
To install composer globally, you have to execute in a shell
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Creating a Laravel Twitter bot
In this post, I will explain how to create a Twitter bot in Laravel. This app will send random tweets (selected from a database) periodically (each hour) and automatically, through the Laravel task scheduling. This project doesn’t have a graphical user interface.
You can download or clone the code from this GitHub repository.
Ejecutar un comando en Laravel en background y/o sin el usuario logueado
Cuando estoy en un entorno de test con aplicaciones en Laravel (esto es extrapolable a cualquier otro entorno de desarrollo y/o framework que disponga de una interfaz de línea o CLI), a veces ejecuto comandos cuya ejecución puede llevar bastante tiempo.
Un ejemplo claro es una migración con un seeder con un alto número de seeds, para probar la aplicación con un entorno sobrecargado de datos.
En este tipo de casos lo ideal es poder dejar el comando en background y poder cerrar la consola si es necesario.
Laravel Homestead TTFB very high
I use Laravel Homestead to develop on two machines. I use it because with this solution I have the same development environment in all my machines and in all machines of my coworkers.
Last Tuesday, with the monthly Microsoft update (I suppose), the HTTP responses starts to become very slow, with TTFB (time to the first byte) from 4 to 10 seconds.
Using Laravel Dusk with Vagrant Homestead
If you are using Laravel Homestead and you want to use Laravel Dusk to test your application, you can find some problems.