You have to use the PHP to register and create an extension in the Magento.
If you want to something related product, then you have to customize the existing logic of the Magneto, that is written in the PHP.
If you want to do some changes on the design side, then you can use the JavaScript.
For registering an extension in magento2, you can follow these steps:
Create Extension Directory:
Start by creating a directory for your extension in the app/code directory of your Magento installation. The directory structure should follow the pattern: app/code/Vendor/Extension
mkdir -p app/code/Vendor/Extension
Create Registration File:
Inside your extension directory, create a registration.php file. This file is required and should contain code to register your extension.
// app/code/Vendor/Extension/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Vendor_Extension',
__DIR__
);
Create Module Configuration File:
Create a file named module.xml inside the etc directory of your extension.
<!-- app/code/Vendor/Extension/etc/module.xml -->
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Extension" setup_version="1.0.0">
<!-- Additional module configurations can go here -->
</module>
</config>
Enable the Module:
After creating the registration and module files, enable the module by running the following command from your Magento root directory:
php bin/magento module:enable Vendor_Extension
Run Upgrade Command:
If your extension requires a database schema or other setup, you might need to run the upgrade Command. This is done using the following command:
php bin/magento setup:upgrade
Clear Cache:
After enabling the module, clear the Magento cache:
php bin/magento cache:clean
Verify Installation:
Verify that your module is installed and active by checking the list of enabled modules:
php bin/magento module:status