This is a Joomla Component Builder CLI tool for creating a Joomla! 4 component using the terminal.
JEXT-CLI is a command-line application for creating Joomla! 4 components using just a simple command. This tool will help you to reduce your job for creating a component. It will provide you a boilerplate for Joomla! 4 component.
The installation process is too easy. You can install it from the source code.
You need PHP CLI
, and composer
are installed in your machine before proceeding next steps.
Note: These processes are only for Linux and macOS. For Windows, these may not work. If you can implement the installation in a Windows machine, please share the idea.
git clone https://github.com/ahamed/jext-cli.git
or Download Zip from github.cd jext-cli
composer install
composer dump-autoload -o
chmod +x install.sh
for making the install.sh
file executable../install.sh
, it will ask for the password, just type your password and hit enter.If no error happens, then you are done installing the jext-cli
tool. Now you can use it globally by using a terminal.
This tool is only for Joomla! 4. So you need to-
cd path/to/the/project/root
jext-cli --version
, if it shows you the version message, then the jext-cli
is installed correctly in your machine.jext-cli --component|-c <name>
For creating a new Joomla! 4 component just run jext-cli --component <name>
. Here the <name>
would be replaced by your component name, and the name should be without com_
prefix. If you add the com_
prefix, then don't worry, this will be sanitized.
After that you will be asking for-
jext-cli
will take the current username as the author name.)(C) {year}, {Author name}
.)MIT
)1.0.0
)Joomla\Component\<ComponentName>
. Using the default is recommended.)no
and hit enter.)Congratulation! You have successfully created your first Joomla! 4 component using jext-cli
tool.
By default jext-cli --component <name>
command creates a component with two default views. One for creating Notes
and another for showing the list of Icomoon
icons with live search facilities. If you don't want these views then add a flag --no-sample-view
with the create command. So the command would be jext-cli --component <name> --no-sample-view
You can also add a view to the component. A view comes with all the required Model
, Controller
and View
files.
jext-cli --view [-f|--front [-b|--back [-bt|--both]]]
The third argument is optional. If you skip it, then the view is generated for the backend/administrator. If you want the view for the frontend then the third argument would be -f
or --front
. You can also create a view for both frontend and backend. For that use the third argument as -bt
or --both
.
jext-cli --view
- for creating a view for the administrator part.jext-cli --view -b|--back
- same as command 1.jext-cli --view -f|--front
- for creating a view for the frontend.jext-cli --view -bt|--both
- for creating a view for both of the administrator or frontend.This command will ask you for some information.
jext-cli
will predict the plural name from the singular name. If you think the prediction is correct then hit enter, otherwise enter the plural name and hit enter.)Congratulations! You have successfully generated a view. Using these commands create all the views you've required.
Now it's time to check our component. We have to install the component first. For installing the component-
Settings > Discover
Install
button from the toolbar.Component
menu from the left sidebar.Note: If you install the component after adding all the views, then all the database tables related with the views will be installed along with the component. Also you can find the views as the submenu of the component. But if you add any view after installing the component, then you have to create a database table associate with the view. The jext-cli tool assumes that every view has a database table. For getting the table definition check the install.sql file inside the administrator component folder of the component.
For more information run jext-cli --help
or jext-cli -h
or just jext-cli
and hit enter.
For contribution-
main
branch, e.g. git checkout -b new_branch
. [Note never work at main if you plan to contribute. Never means never.]Currently phpcs
testing is integrated. If you interested and make a PR then first make sure that you pass the test of phpcs
. Testing this is simple, just run-
composer run-script phpcs
If you get any problems then raise an issue here or send me at [email protected] but first option is preferable.