Posts

Showing posts with the label laravel

Laravel 11 cannot connect to Redis (serverless) - Checking points

Image
 If you are having trouble connecting to Redis server (usually AWS, other cloud platform applied as well), here are some of my tested ideas to check. All points are valid as of this writing, under Laravel 11 (Using Nginx + php-fpm, all dockerize), and build/executed in AWS ECS As of this writing(5 Jul 2024), please use REDIS_CLIENT = phpredis.  predis did not work.  It will not able to connect to your AWS redis (serverless) server.  Yet it works if you setup in your local development In my setting, REDIS_CLUSTER = rediss (double s), before that default value is `redis` There are 3 array sections: default, cache and session default: according to this git comment , this is for "normal" server.  I guess it means standalone server.  Which means the settings under default is for normal server. cache: These settings are for cluster.  I found that serverless = cluster. session: These settings are for sessions, if you are saving session data in redis...

Laravel 11: Encrypted string length for database (MySQL)

In Laravel, as of this writing, the encryption string length different for different length of source string. Here is the list Encrypted string length: 200 for 1 - 15 chars Encrypted string length: 228 for 16 - 31 chars Encrypted string length: 256 for 32 - 47 chars ... In other words, for every 15 chars increases in source string length, the encrypted string length increased 28 chars accordingly. Which also means: if your table column with set to 200, it stores maximum 15 chars of source string length. Hope it helps.

[Easy to understand] What are Service, Service Container and Service Provider in PHP Laravel?

Imagine you are running a restaurant. Let's break down the concepts of Service, Service Container, and Service Provider using this restaurant analogy: Service: In our restaurant analogy, a service is like a specific task or job that needs to be done. For example, a "Waiter Service" would involve taking orders, serving food, and delivering the bill to the customers. Each service has a specific responsibility. Service Container: The service container is like the restaurant itself. It holds all the services (tasks) that need to be performed. Just like how a restaurant has different sections (kitchen, dining area, bar), the service container in Laravel holds different services that can be accessed when needed. When a customer (controller) needs a specific service (task), they ask the restaurant (service container) to provide it. Service Provider: The service provider is like the manager of the restaurant. They are responsible for setting up the restaurant, organizing the serv...