├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ └── jext.yml
├── .gitignore
├── LICENSE
├── README.md
├── bin
└── jext-cli
├── composer.json
├── composer.lock
├── docs
├── _config.yml
└── index.md
├── install.sh
├── phpcs.xml
└── src
├── Application.php
├── Assets
├── component
│ ├── administrator
│ │ ├── access.jext
│ │ ├── component.jext
│ │ ├── config.jext
│ │ ├── forms
│ │ │ ├── filter_notes.jext
│ │ │ └── note.jext
│ │ ├── helpers
│ │ │ └── component.jext
│ │ ├── services
│ │ │ └── provider.jext
│ │ ├── sql
│ │ │ └── install.mysql.utf8.jext
│ │ ├── src
│ │ │ ├── Controller
│ │ │ │ ├── DisplayController.jext
│ │ │ │ ├── IcomoonController.jext
│ │ │ │ ├── NoteController.jext
│ │ │ │ └── NotesController.jext
│ │ │ ├── Extension
│ │ │ │ └── ExtensionComponent.jext
│ │ │ ├── Helper
│ │ │ │ ├── ExtensionHelper.jext
│ │ │ │ └── Icomoon.jext
│ │ │ ├── Model
│ │ │ │ ├── NoteModel.jext
│ │ │ │ └── NotesModel.jext
│ │ │ ├── Service
│ │ │ │ └── HTML
│ │ │ │ │ └── Icon.jext
│ │ │ ├── Table
│ │ │ │ └── NoteTable.jext
│ │ │ └── View
│ │ │ │ ├── Icomoon
│ │ │ │ └── HtmlView.jext
│ │ │ │ ├── Note
│ │ │ │ └── HtmlView.jext
│ │ │ │ └── Notes
│ │ │ │ └── HtmlView.jext
│ │ └── tmpl
│ │ │ ├── icomoon
│ │ │ └── default.jext
│ │ │ ├── note
│ │ │ └── edit.jext
│ │ │ └── notes
│ │ │ └── default.jext
│ └── site
│ │ ├── src
│ │ ├── Controller
│ │ │ ├── DisplayController.jext
│ │ │ └── NotesController.jext
│ │ ├── Dispatcher
│ │ │ └── Dispatcher.jext
│ │ ├── Helper
│ │ │ └── RouteHelper.jext
│ │ ├── Model
│ │ │ ├── NoteModel.jext
│ │ │ └── NotesModel.jext
│ │ ├── Service
│ │ │ └── Router.jext
│ │ └── View
│ │ │ ├── Note
│ │ │ └── HtmlView.jext
│ │ │ └── Notes
│ │ │ └── HtmlView.jext
│ │ └── tmpl
│ │ ├── note
│ │ └── default.jext
│ │ └── notes
│ │ ├── default.jext
│ │ └── menu.jext
├── injection
│ ├── administrator
│ │ ├── install.sql.jext
│ │ ├── language.jext
│ │ ├── language.sys.jext
│ │ └── submenu.jext
│ ├── media
│ │ └── asset.jext
│ └── site
│ │ ├── menuitem.language.jext
│ │ ├── router.jext
│ │ └── router.methods.jext
├── language
│ ├── administrator
│ │ ├── extension.jext
│ │ └── extension.sys.jext
│ └── site
│ │ └── extension.jext
├── media
│ ├── css
│ │ ├── icons.jext
│ │ ├── notes.jext
│ │ └── styles.jext
│ ├── joomla.asset.jext
│ └── js
│ │ └── icons.jext
└── view
│ ├── administrator
│ ├── forms
│ │ ├── filter.jext
│ │ └── form.jext
│ ├── src
│ │ ├── Controller
│ │ │ ├── plural.jext
│ │ │ └── singular.jext
│ │ ├── Model
│ │ │ ├── plural.jext
│ │ │ └── singular.jext
│ │ ├── Table
│ │ │ └── table.jext
│ │ └── View
│ │ │ ├── {{plural_capitalize}}
│ │ │ └── HtmlView.jext
│ │ │ └── {{singular_capitalize}}
│ │ │ └── HtmlView.jext
│ └── tmpl
│ │ ├── {{plural}}
│ │ └── default.jext
│ │ └── {{singular}}
│ │ └── edit.jext
│ └── site
│ ├── src
│ ├── Controller
│ │ └── plural.jext
│ ├── Model
│ │ ├── plural.jext
│ │ └── singular.jext
│ └── View
│ │ ├── {{plural_capitalize}}
│ │ └── HtmlView.jext
│ │ └── {{singular_capitalize}}
│ │ └── HtmlView.jext
│ └── tmpl
│ ├── {{plural}}
│ ├── default.jext
│ └── menu.jext
│ └── {{singular}}
│ └── default.jext
├── Controllers
├── BaseController.php
├── ComponentController.php
├── HelpController.php
├── VersionController.php
└── ViewController.php
├── Interfaces
├── ControllerInterface.php
└── RegistryInterface.php
├── Parsers
├── InjectionParser.php
└── SourceParser.php
├── Registry.php
└── Utils
├── ComponentHelper.php
├── Printer.php
├── SourceMap.php
└── Utils.php
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: sisylana
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Actual behavior**
24 | What did you get except the expected behavior?
25 |
26 | **Screenshots**
27 | If applicable, add screenshots to help explain your problem.
28 |
29 | **Additional context**
30 | Add any other context about the problem here.
31 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/jext.yml:
--------------------------------------------------------------------------------
1 | name: JEXT-CLI workflow
2 |
3 | on:
4 | pull_request:
5 | push:
6 | branches:
7 | - main
8 | - dev
9 | jobs:
10 | build:
11 | strategy:
12 | matrix:
13 | operating-system: [ubuntu-latest]
14 | php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
15 |
16 | runs-on: ${{ matrix.operating-system }}
17 |
18 | steps:
19 | - uses: actions/checkout@v2
20 |
21 | - name: Get composer cache directory
22 | id: composer-cache
23 | run: echo "::set-output name=dir::$(composer config cache-files-dir)"
24 | - name: Cache composer dependencies
25 | uses: actions/cache@v2
26 | with:
27 | path: ${{ steps.composer-cache.outputs.dir }}
28 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
29 | restore-keys: ${{ runner.os }}-composer-
30 | - name: Install dependencies
31 | run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
32 | - name: phpcs
33 | run: composer run-script phpcs
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | composer.phar
2 | /vendor/
3 | .DS_Store
4 | .vscode/
5 |
6 | # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
7 | # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
8 | # composer.lock
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Sajeeb Ahamed (sajeeb07ahamed@gmail.com)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JEXT-CLI
2 |
3 | 
4 |
5 |
6 |
7 | **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.
8 |
9 |
10 | # Installation
11 | The installation process is too easy. You can install it from the source code.
12 |
13 | ### Prerequisites
14 | You need `PHP CLI`, and `composer` are installed in your machine before proceeding next steps.
15 |
16 | **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.**
17 |
18 | #### Steps:
19 | 1. Clone the repository using git `git clone https://github.com/ahamed/jext-cli.git` **or** [Download Zip](https://github.com/ahamed/jext-cli/archive/v1.0.0-beta.1.zip) from github.
20 | 2. Extract the zip file.
21 | 3. Go to the directory, run `cd jext-cli`
22 | 4. Install project dependencies, run `composer install`
23 | 5. Regenerate the class lists for auto-loading, run `composer dump-autoload -o`
24 | 6. Run `chmod +x install.sh` for making the `install.sh` file executable.
25 | 7. Run `./install.sh`, it will ask for the password, just type your password and hit enter.
26 |
27 | If no error happens, then you are done installing the `jext-cli` tool. Now you can use it globally by using a terminal.
28 |
29 | # Usage
30 | This tool is only for Joomla! 4. So you need to-
31 | 1. [Download](https://downloads.joomla.org) and Install Joomla 4.
32 | 2. Go to the Joomla! project's root directory, run `cd path/to/the/project/root`
33 | 3. Run `jext-cli --version`, if it shows you the version message, then the `jext-cli` is installed correctly in your machine.
34 |
35 | ### Creating a new Joomla! component:
36 | #### Syntax
37 | ```shell
38 | jext-cli --component|-c
39 | ```
40 |
41 | + For creating a new Joomla! 4 component just run `jext-cli --component `. Here the `` 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.
42 |
43 | + After that you will be asking for-
44 | + **Author name** (What is the name of the component author. If skip `jext-cli` will take the current username as the author name.)
45 | + **Author Email** (The email address of the component author. If skip then it will be empty.)
46 | + **Author Url** (The author website url, If skip then it will be empty.)
47 | + **Description** (The component description. If skip then it will be empty.)
48 | + **Copyright** (Copyright information, default `(C) {year}, {Author name}`.)
49 | + **License** (Component license information, default `MIT`)
50 | + **Version** (Component initial version number, default `1.0.0`)
51 | + **Namespace** (The component's namespace, default `Joomla\Component\`. Using the default is recommended.)
52 | + **Do you confirm component creation?** (Hit enter if everything is okay. If not then type `no` and hit enter.)
53 |
54 | Congratulation! You have successfully created your first Joomla! 4 component using `jext-cli` tool.
55 | By default `jext-cli --component ` 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 --no-sample-view`
56 | ### Creating a view to the component:
57 | You can also add a view to the component. A view comes with all the required `Model`, `Controller` and `View` files.
58 |
59 | #### Syntax:
60 | ```shell
61 | jext-cli --view [-f|--front [-b|--back [-bt|--both]]]
62 | ```
63 | 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`.
64 |
65 | #### Available commands
66 | 1. `jext-cli --view` - for creating a view for the administrator part.
67 | 2. `jext-cli --view -b|--back` - same as command 1.
68 | 3. `jext-cli --view -f|--front` - for creating a view for the frontend.
69 | 4. `jext-cli --view -bt|--both` - for creating a view for both of the administrator or frontend.
70 |
71 | This command will ask you for some information.
72 | - [required] **Component Name** (The component name where to put the view)
73 | - [required] **View name (Singular)** (The singular name of the view)
74 | - [optional] **View name (Plural)** (The plural name of the view. The `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.)
75 |
76 | Congratulations! You have successfully generated a view.
77 | Using these commands create all the views you've required.
78 |
79 | Now it's time to check our component. We have to install the component first.
80 | For installing the component-
81 | 1. Login as a super user to the administrator panel.
82 | 2. Go to `Settings > Discover`
83 | 3. Select the component to install and click the `Install` button from the toolbar.
84 | 4. The component is installed. For checking this go to the `Component` menu from the left sidebar.
85 |
86 | __Note: If you install the component after adding all the views,
87 | then all the database tables related with the views will be installed along with
88 | the component. Also you can find the views as the submenu of the component. But if you add any view
89 | after installing the component, then you have to create a database table associate with the view.
90 | The jext-cli tool assumes that every view has a database table. For getting the table
91 | definition check the install.sql file inside the administrator component folder of the component.__
92 |
93 | ___For more information run `jext-cli --help` or `jext-cli -h` or just `jext-cli` and hit enter.___
94 |
95 | # Contribution
96 | For contribution-
97 | 1. Fork the repository.
98 | 2. Clone the forked repository to your local machine.
99 | 3. Create a new branch from the `main` branch, e.g. `git checkout -b new_branch`. [Note never work at main if you plan to contribute. Never means never.]
100 | 4. Commit your changes and push to your remote.
101 | 5. Make a pull request (PR) to this repository.
102 |
103 | # Test
104 | 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-
105 |
106 | ```console
107 | composer run-script phpcs
108 | ```
109 |
110 | # Support
111 | If you get any problems then raise an issue [here](https://github.com/ahamed/jext-cli/issues) or send me at [sajeeb07ahamed@gmail.com](mailto:sajeeb07ahamed@gmail.com) but first option is preferable.
112 |
--------------------------------------------------------------------------------
/bin/jext-cli:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | run($argv);
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ahamed/jext-cli",
3 | "description": "This is a cli tool for building joomla component",
4 | "type": "library",
5 | "license": "MIT",
6 | "version": "1.0.0",
7 | "authors": [
8 | {
9 | "name": "Sajeeb Ahamed",
10 | "email": "sajeeb07ahamed@gmail.com"
11 | }
12 | ],
13 | "scripts": {
14 | "phpcs": "./vendor/bin/phpcs --extensions=php -p ."
15 | },
16 | "autoload": {
17 | "psr-4": {
18 | "Ahamed\\Jext\\": "src/"
19 | }
20 | },
21 | "require-dev": {
22 | "squizlabs/php_codesniffer": "*"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 | "This file is @generated automatically"
6 | ],
7 | "content-hash": "68f0ad47378c538eaa2a01c68f60f156",
8 | "packages": [],
9 | "packages-dev": [
10 | {
11 | "name": "squizlabs/php_codesniffer",
12 | "version": "3.5.8",
13 | "source": {
14 | "type": "git",
15 | "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
16 | "reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
17 | },
18 | "dist": {
19 | "type": "zip",
20 | "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
21 | "reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
22 | "shasum": ""
23 | },
24 | "require": {
25 | "ext-simplexml": "*",
26 | "ext-tokenizer": "*",
27 | "ext-xmlwriter": "*",
28 | "php": ">=5.4.0"
29 | },
30 | "require-dev": {
31 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
32 | },
33 | "bin": [
34 | "bin/phpcs",
35 | "bin/phpcbf"
36 | ],
37 | "type": "library",
38 | "extra": {
39 | "branch-alias": {
40 | "dev-master": "3.x-dev"
41 | }
42 | },
43 | "notification-url": "https://packagist.org/downloads/",
44 | "license": [
45 | "BSD-3-Clause"
46 | ],
47 | "authors": [
48 | {
49 | "name": "Greg Sherwood",
50 | "role": "lead"
51 | }
52 | ],
53 | "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
54 | "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
55 | "keywords": [
56 | "phpcs",
57 | "standards"
58 | ],
59 | "support": {
60 | "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
61 | "source": "https://github.com/squizlabs/PHP_CodeSniffer",
62 | "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
63 | },
64 | "time": "2020-10-23T02:01:07+00:00"
65 | }
66 | ],
67 | "aliases": [],
68 | "minimum-stability": "stable",
69 | "stability-flags": [],
70 | "prefer-stable": false,
71 | "prefer-lowest": false,
72 | "platform": [],
73 | "platform-dev": [],
74 | "plugin-api-version": "2.0.0"
75 | }
76 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
2 | title: "JEXT CLI"
3 | description: "JEXT CLI is a component builder tool for Joomla! By using this command line tool you can easily build a Joomla! 4 component by just write a simple command."
4 | show_downloads: "true"
5 | google_analytics: "G-CY134LGBYY"
6 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | **JEXT-CLI** is a command line application for creating Joomla! 4 component 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.
4 |
5 | Author: Sajeeb Ahamed (sajeeb07ahamemd@gmail.com)
6 |
7 | Tags: #joomla, #joomla-component-builder, #joomla-extension-builder, #jext-cli, #php-cli, #cli, #components, #extensions.
8 |
9 | Hello, all the Joomla extension developers. Today I am going to share with you a nice CLI application for generating Joomla! 4 components. So, tie your belt, and let's start the journey.
10 |
11 | The stable version of Joomla! 4 is going to release very soon. And as it is a major release so there are some major changes that may break your existing extensions. So it would be hard for the developers to upgrade the extensions from Joomla! 3 to 4.
12 | Now in this statement, you may disagree with me that upgrading from 3 to 4 is not that much hard. If one already makes compatible his/her extension for `3.9.x` then it's easy. I also agree with you. But Joomla! 4 brings a newly organized component structure for you. What if you want to taste the original flavor? You need to do more.
13 |
14 | So, in this situation, I am here to introduce you to a new CLI application. The application helps you to create a component by just running a simple command in the terminal. This will provide you a boilerplate of a structured Joomla! 4 component.
15 |
16 | By using this you can create a new component and also brings your business logic from your existing components after creating a new component (as J4 still provides you MVC structure).
17 |
18 | Here the question is how to use it? It's quite easy. Just follow me-
19 |
20 | > For using the `jext-cli` you need **php-cli** and **composer** installed in your machine. The installation is written for Linux & Mac users. For Windows users, this is not going to work.
21 |
22 | ### Installation
23 | 1. Clone the Github repository `git clone https://github.com/ahamed/jext-cli.git`
24 | 2. Navigate to the directory, `cd jext-cli`
25 | 3. Install the project dependencies, `composer install`
26 | 4. Update the auto-loading classes, `composer dump-autoload -o`
27 | 5. Install the CLI tool, `./install.sh` (for macOS & Linux)
28 | 6. Check if the tool is installed, `jext-cli --help`
29 |
30 | If you find the manuscript that means the `jext-cli` is installed on your machine globally.
31 |
32 | ### Usage
33 | You can create components and views for a component now. For creating a component first navigate to your Joomla! 4 project root directory, `cd path/to/your/project/root`, then run-
34 |
35 | ```console
36 | jext-cli --component|-c
37 | ```
38 | Here, `--component|-c` means any of `--component` or `-c`, and the `` is the name of your component. Please don't use a multi-word name as a component name.
39 |
40 | This command will ask for some basic meta-information. They are-
41 | + **Author name** (What is the name of the component author. If skip `jext-cli` will take the current username as author name.)
42 |
43 | + **Author Email** (The email address of the component author. If skip then it will be empty.)
44 | + **Author Url** (The author website url, If skip then it will be empty.)
45 | + **Description** (The component description. If skip then it will be empty.)
46 | + **Copyright** (Copyright information, default `(C) {year}, {Author name}`.)
47 | + **License** (Component license information, default `MIT`)
48 | + **Version** (Component initial version number, default `1.0.0`)
49 | + **Namespace** (The component's namespace, default `Joomla\Component\`. Using the default is recommended.)
50 | + **Do you confirm component creation?** (Hit enter if everything is okay. If not then type `no` and hit enter.)
51 |
52 | Fill them up correctly and this will create the component.
53 |
54 | _By default, the **JEXT-CLI** creates a component with two sample views. If you don't want to create the views with the component then use `--no-sample-view` flag with it. For example-_
55 |
56 | ```console
57 | jext-cli --component --no-sample-view
58 | ```
59 |
60 | Here you successfully created your component. Now we know all components have one or more views. The views are categorized into two types. Administrator view and site view. Here the administrator views are called `back` views, and the site views are called `front` views. For creating a view, the command is-
61 |
62 | ```console
63 | jext-cli --view [--back|-b, [--front|-f, [--both|-bt]]]
64 | ```
65 |
66 | Here, the `[--back|-b, [--front|-f, [--both|-bt]]]` means any of the six options. If I describe the options, then they are-
67 |
68 | - `--back|-b` means either `--back` or `-b` which stands for the back view or the administrator view.
69 | - `--front|-f` means either `--front` or `-f` which stands for the front view or the site view.
70 | - `--both|-bt` means either `--both` or `-bt` stands for both administrator and site views.
71 |
72 | After running any of the commands the application asks you the component name. This indicates for which component you are going to create a view.
73 |
74 | After putting the valid component name the system will ask you for the view's names. You have to enter two names for a view. One is the singular name and another is the plural name. The `JEXT-CLI` can predict the plural name after you entering the singular name. If you think the prediction is correct then just hit enter otherwise, enter the plural name. That's all for creating a view. All the related (controller, model, view) files are created for you. This also injects the required language strings, SQL queries, and other required codes for making the view functional.
75 |
76 | Your view is created. You can create as many views as you need. After creating all the views log in as `administrator` to the project then go to `Settings > Discover`. There you can see the component waits for you to install. Select the component and click the `Install` button from the toolbar.
77 |
78 | Hurra! the component has been installed. Now from the sidebar, go to `Components > Your component`. Here you get your views.
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ ! -d ~/.jext-cli ]
4 | then
5 | mkdir ~/.jext-cli
6 | fi
7 |
8 | # Copy the project files to the include directory.
9 | cp -r * ~/.jext-cli
10 |
11 | if [ -L /usr/local/bin/jext-cli ]
12 | then
13 | sudo rm /usr/local/bin/jext-cli
14 | fi
15 |
16 | sudo ln -s ~/.jext-cli/bin/jext-cli /usr/local/bin/jext-cli
17 |
18 | tput setaf 2; echo "Installation Completed Successfully!: "$1; tput sgr0;
19 | tput setaf 3; echo "Welcome to Jext-CLI: "$1; tput sgr0;
20 | echo "You are using: "
21 | jext-cli --version
22 | tput setaf 2; echo "You can perform these operations: "$1; tput sgr0;
23 | jext-cli --help
--------------------------------------------------------------------------------
/src/Application.php:
--------------------------------------------------------------------------------
1 |
6 | * @license MIT
7 | */
8 |
9 | namespace Ahamed\Jext;
10 |
11 | use Ahamed\Jext\Controllers\ComponentController;
12 | use Ahamed\Jext\Controllers\HelpController;
13 | use Ahamed\Jext\Controllers\VersionController;
14 | use Ahamed\Jext\Controllers\ViewController;
15 | use Ahamed\Jext\Registry;
16 |
17 | /**
18 | * The main CLI Application class.
19 | *
20 | * @since 1.0.0
21 | */
22 | class Application
23 | {
24 | /**
25 | * Command Registry instance.
26 | *
27 | * @var CommandRegistry $registry the registry instance.
28 | *
29 | * @since 1.0.0
30 | */
31 | protected $registry = null;
32 |
33 | /**
34 | * Set the default command for the application.
35 | *
36 | * @var string $defaultCommand The default command name.
37 | *
38 | * @since 1.0.0
39 | */
40 | protected $defaultCommand = '--help';
41 |
42 | /**
43 | * The application constructor function
44 | *
45 | * @since 1.0.0
46 | */
47 | public function __construct()
48 | {
49 | $this->registry = new Registry;
50 | }
51 |
52 | /**
53 | * Run commander function.
54 | *
55 | * @param array $argv The CLI arguments array.
56 | *
57 | * @return void
58 | *
59 | * @since 1.0.0
60 | */
61 | public function run(array $argv = [])
62 | {
63 | $command = $argv[1] ?? $this->defaultCommand;
64 |
65 | switch ($command)
66 | {
67 | case '--component':
68 | case '-c':
69 | $this->registry->registerController($command, new ComponentController);
70 | \call_user_func($this->registry->getRegistry($command), $argv);
71 | break;
72 |
73 | case '--view':
74 | $this->registry->registerController($command, new ViewController);
75 | \call_user_func($this->registry->getRegistry($command), $argv);
76 | break;
77 |
78 | case '--version':
79 | case '-v':
80 | $this->registry->registerController($command, new VersionController);
81 | \call_user_func($this->registry->getRegistry($command), $argv);
82 | break;
83 |
84 | case '--help':
85 | case '-h':
86 | default:
87 | $this->registry->registerController($command, new HelpController);
88 | \call_user_func($this->registry->getRegistry($command), $argv);
89 | break;
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/access.jext:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/component.jext:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{prefix_component}}
4 | {{author}}
5 | {{creationDate}}
6 | {{copyright}}
7 | {{license}}
8 | {{email}}
9 | {{url}}
10 | {{version}}
11 | {{prefix_component_uppercase}}_XML_DESCRIPTION
12 | {{namespace}}
13 |
14 |
15 |
16 |
17 | sql/install.mysql.utf8.sql
18 |
19 |
20 |
21 |
22 | forms
23 | helpers
24 | src
25 | tmpl
26 |
27 |
28 |
29 | language/en-GB/{{prefix_component}}.ini
30 |
31 |
32 |
33 | js
34 |
35 |
36 |
37 |
38 |
39 |
43 |
45 |
47 |
48 |
49 |
50 | access.xml
51 | config.xml
52 | {{component}}.xml
53 | forms
54 | helpers
55 | services
56 | sql
57 | src
58 | tmpl
59 |
60 |
61 | language/en-GB/{{prefix_component}}.ini
62 | language/en-GB/{{prefix_component}}.sys.ini
63 |
64 |
65 |
66 | {{component}}
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/config.jext:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
25 |
26 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/forms/filter_notes.jext:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/forms/note.jext:
--------------------------------------------------------------------------------
1 |
2 |
130 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/helpers/component.jext:
--------------------------------------------------------------------------------
1 | registerServiceProvider(new MVCFactory('{{namespace}}'));
44 | $container->registerServiceProvider(new ComponentDispatcherFactory('{{namespace}}'));
45 | $container->registerServiceProvider(new RouterFactory('{{namespace}}'));
46 |
47 | $container->set(
48 | ComponentInterface::class,
49 | function (Container $container)
50 | {
51 | $component = new {{component_capitalize}}Component($container->get(ComponentDispatcherFactoryInterface::class));
52 |
53 | $component->setRegistry($container->get(Registry::class));
54 | $component->setMVCFactory($container->get(MVCFactoryInterface::class));
55 | $component->setRouterFactory($container->get(RouterFactoryInterface::class));
56 |
57 | return $component;
58 | }
59 | );
60 | }
61 | };
62 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/sql/install.mysql.utf8.jext:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS `#__{{component}}_notes` (
2 | `id` bigint NOT NULL AUTO_INCREMENT,
3 | `asset_id` bigint NOT NULL DEFAULT 0,
4 | `title` varchar(255) NOT NULL DEFAULT '',
5 | `alias` varchar(300) NOT NULL DEFAULT '',
6 | `description` text,
7 | `published` tinyint(1) NOT NULL DEFAULT 0,
8 | `checked_out` int unsigned NOT NULL DEFAULT 0,
9 | `checked_out_time` datetime,
10 | `ordering` int NOT NULL DEFAULT 0,
11 | `access` int unsigned NOT NULL DEFAULT 0,
12 | `language` varchar(7) NOT NULL DEFAULT '*',
13 | `created` datetime NOT NULL,
14 | `created_by` int unsigned NOT NULL DEFAULT 0,
15 | `modified` datetime NOT NULL,
16 | `modified_by` int unsigned NOT NULL DEFAULT 0,
17 | PRIMARY KEY (`id`)
18 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
19 |
20 | --{{inject: install_table}}
--------------------------------------------------------------------------------
/src/Assets/component/administrator/src/Controller/DisplayController.jext:
--------------------------------------------------------------------------------
1 | input->get('view', 'notes');
46 | $layout = $this->input->get('layout', 'default');
47 | $id = $this->input->getInt('id', 0);
48 |
49 | // Check for edit form.
50 | if ($view === 'note' && $layout === 'edit' && !$this->checkEditId('{{prefix_component}}.edit.note', $id))
51 | {
52 | // Somehow the person just went to the form - we don't allow that.
53 | $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
54 | $this->setRedirect(Route::_('index.php?option={{prefix_component}}&view=notes', false));
55 |
56 | return false;
57 | }
58 |
59 | return parent::display();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/Assets/component/administrator/src/Controller/IcomoonController.jext:
--------------------------------------------------------------------------------
1 | input->getString('keyword', '');
55 | $icons = Icomoon::getIcons($keyword);
56 |
57 | $html = [];
58 |
59 | if (!empty($icons))
60 | {
61 | foreach ($icons as $icon)
62 | {
63 | $html[] = '';
64 | $html[] = '