PHP Enterprise Systems Blog
126 FOLLOWERS
Ruben Elizondo is currently working at Slashdot Media as Principal Software Engineer. He has more than 20 years of Software Development experience and is focused on Enterprise Systems.
PHP Enterprise Systems Blog
8M ago
Sometimes we need to deal with heavy images that could make page load to slow down. This PHP script will help you to easily process and scale down all images in a directory and its sub directories recursively. The script can very easily be ported to any PHP framework just inserting the functions in a class and calling them as showed here:
Read More ..read more
PHP Enterprise Systems Blog
9M ago
DOM (Document Object Model) manipulation with jQuery allows you to easily interact with and modify HTML elements on a webpage. jQuery simplifies these tasks by providing a convenient and efficient way to select elements and perform various operations on them. To get started, make sure you have included the jQuery library in your HTML file.
You can do this by including the following script tag in the <head> section or just before the closing <body> tag
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
Selecting Elements
To manipulate ele ..read more
PHP Enterprise Systems Blog
9M ago
Event handling in jQuery allows you to respond to user interactions with elements on the web page. Below are some examples of event handling using jQuery.
HTML
<!DOCTYPE html>
<html>
<head>
<title>jQuery Event Handling Examples</title>
</head>
<body>
<button id="btnClick">Click Me</button>
<input type="text" id="textInput">
<p>Hover over this paragraph.</p>
<select id="selectOption">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option> ..read more
PHP Enterprise Systems Blog
9M ago
Here are some examples of selecting elements with jQuery.
HTML
<!DOCTYPE html>
<html>
<head>
<title>jQuery Element Selection Examples</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a paragraph.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://phpenterprisesystems.com/script.js"></script>
</body>
</html&g ..read more
PHP Enterprise Systems Blog
9M ago
Using jQuery's $(document).ready() function is a way to ensure that your JavaScript code executes only after the HTML document has been fully loaded. It prevents issues where your code tries to access elements before they are available in the DOM.
Here's an example of how to use $(document).ready()
HTML
<!DOCTYPE html>
<html>
<head>
<title>jQuery Document Ready Example</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a simple example demonstrating the use of jQuery's document ready function.</p>
<button id="m ..read more
PHP Enterprise Systems Blog
9M ago
To interact with Elasticsearch from a service class using Symfony, you'll need to use the Elasticsearch PHP client, which provides a convenient way to perform CRUD operations on the Elasticsearch cluster. Here's an example of how you can achieve this:
Install the Elasticsearch PHP client via Composer:
composer require elasticsearch/elasticsearch
Create the Symfony service class that will interact with Elasticsearch:
Assuming you have a Symfony project set up, create a new service class (e.g., ElasticsearchService) under the src/Services directory:
Read More ..read more
PHP Enterprise Systems Blog
9M ago
In all web applications, user input is handled by HTML Forms. Symfony has the form component to make easy and fast form implementation and handling. Here is a basic form layout that you may use to implement your own forms:
Basic Form Creation:
Let's say you want to create a simple contact form with a name, email, and message field.
// src/Form/ContactFormType.php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\Te ..read more
PHP Enterprise Systems Blog
9M ago
Data validation is one of the most important parts of all Software Applications. If you are using PHP Symfony Framework, you have available a very powerful yet easy to use validator* component that validates objects against constraints. There is a large set of Constraints ready to use and even you can define your own custom constraints when using this component.
If you are implementing an Application as a Rest Api I recommend you first take a look at Using DTOs in PHP Symfony
Using DTOs and the Param Converter in Symfony allows you to do Data validation in a very easy way, and very fast ..read more
PHP Enterprise Systems Blog
9M ago
Modern PHP Enterprise Systems Applications require the ability to notify the users about things like a process done, a report available, etc. through standard popular communication channels like email, text messages, slack etc. Follow this recipe if you want to send user notifications to their Slack channels:
Prerequisites:
How to install Composer 2 in a Virtual Machine in 3 simple steps
How to install Symfony Framework using composer in 2 easy steps
Step 1. Install the "symfony/slack-notifier" package using composer:
composer require symfony/slack-notifier
Step 2. Create a Slack bot by fo ..read more
PHP Enterprise Systems Blog
10M ago
To install kubectl without using sudo on Ubuntu 22, you can follow these steps:
Download kubectl binary:
Open a terminal and use `curl` to download the kubectl binary from the official Kubernetes repository. Make sure to download the appropriate version for your platform (e.g., 64-bit Linux):
curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Create a local bin directory:
Next, create a local `bin` directory in your home folder where you'll store the kubectl binary:
mkdir -p ~/bin
Read More ..read more