All posts by Pramod T P

React vs next JS

React.js

  • A library for building user interfaces.
  • Great for SPAs (Single Page Applications) where client-side
  • rendering (CSR) is enough.
  • Requires additional setup for routing, state management, and API
  • handling (e.g., using React Router, Redux, etc.).
  • More flexibility but requires manual configuration for things like SSR, SEO, and performance optimizations.

Next.js

  • A framework built on top of React.
  • Provides SSR (Server-Side Rendering), SSG (Static Site
  • Generation), and ISR (Incremental Static Regeneration) for better SEO and performance.
  • Comes with built-in routing (file-based), API routes, and full-stack capabilities.
  • Ideal for fast-loading, SEO-friendly websites, such as e-commerce platforms, blogs, and dashboards.

Difference Between composer.json and composer.lock Files

The composer.json and composer.lock files are both essential in managing dependencies in PHP projects using Composer, but they serve different purposes:

1. composer.json
Purpose: This is the main configuration file where you define your project’s dependencies, scripts, and other metadata.

Content: It includes the list of required packages, version constraints, and other settings like autoload configurations, scripts, and repositories.

Usage: When you run composer install, Composer reads this file to determine which packages and versions to install.

2. composer.lock
Purpose: This file is automatically generated by Composer and records the exact versions of the dependencies installed in your project.

Content: It contains detailed information about each package, including the exact version, source, and dependencies.

Usage: When you run composer install, Composer uses this file to install the exact versions of the dependencies specified, ensuring consistency across installations.

Editable: This file should not be manually edited. It is updated automatically when you run composer update or when you install new dependencies.

Key Differences:
Control: composer.json is manually controlled by the developer, while composer.lock is automatically managed by Composer.

Versioning: composer.json specifies version constraints (e.g., ^2.0), whereas composer.lock records the exact versions installed.

Consistency: composer.lock ensures that all installations of the project use the same versions of dependencies, providing consistency across different environments.

Best Practices:
Development: Use composer.json to define your dependencies and version constraints.

Deployment: Always commit composer.lock to your version control system (e.g., Git) to ensure that all team members and deployment environments use the same dependency versions.

Updates: Run composer update to update dependencies and generate a new composer.lock file when you want to upgrade to newer versions within the constraints defined in composer.json.

By understanding and using both files correctly, you can effectively manage your PHP project’s dependencies and ensure a consistent development and deployment environment.

 

Magento 2 disable captcha from admin login form

Disable Using Command Line

php bin/magento config:set admin/captcha/enable 0
php bin/magento cache:flush

Disable Directly in Database

UPDATE core_config_data
SET value = 0
WHERE path = ‘admin/captcha/enable’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/fonts%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/mode’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/forms%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/enable%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/always_for%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/type%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/timeout%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/failed_attempts_logging%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/max_attempts%’;