{"id":13805440,"url":"https://github.com/corentin-begne/phalconTool","last_synced_at":"2025-05-13T19:31:15.934Z","repository":{"id":35212863,"uuid":"39471911","full_name":"corentin-begne/phalconTool","owner":"corentin-begne","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-28T16:30:49.000Z","size":19356,"stargazers_count":27,"open_issues_count":1,"forks_count":6,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-28T17:38:26.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corentin-begne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SecurityPlugin.html","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-07-21T21:56:26.000Z","updated_at":"2025-04-28T16:30:52.000Z","dependencies_parsed_at":"2025-04-28T17:42:10.103Z","dependency_job_id":null,"html_url":"https://github.com/corentin-begne/phalconTool","commit_stats":{"total_commits":318,"total_committers":1,"mean_commits":318.0,"dds":0.0,"last_synced_commit":"6b99c208c2f044da2c30c9f91e5793624a9ac907"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corentin-begne%2FphalconTool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corentin-begne%2FphalconTool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corentin-begne%2FphalconTool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corentin-begne%2FphalconTool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corentin-begne","download_url":"https://codeload.github.com/corentin-begne/phalconTool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254012968,"owners_count":21999346,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:01:01.205Z","updated_at":"2025-05-13T19:31:10.916Z","avatar_url":"https://github.com/corentin-begne.png","language":"JavaScript","funding_links":[],"categories":["Application Skeleton"],"sub_categories":[],"readme":"# phalconTool\n\nThis is an alternative to the official [Phalcon Devtools](https://docs.phalcon.io/5.0/fr-fr/devtools).  \nThis tool allows you to manage projects with Phalcon MVC Framework accessing MYSQL.  \nFor Phalcon 4 and php7 use v4 branche, for JavaScript support use javascript branch.  \n\n## Features\n\n- Create skeleton project application with default User controller.\n- Users and Langs/Translations management base.\n- Manage multi application/environment.\n- Generate models from Mysql database with column map and full relations.\n- Internal library Management.\n- Full Rest Api.\n- Database migration engine and data management.\n- SCRUD on the fly with models relations and validations.\n- Generate controller/action.\n- Generate js/sass/helper templates and builds.\n\n## Documentation\n\n[PHP Documentation](https://corentin-begne.github.io/phalconTool/)\n\n# Installation\n\n## Requirement\n\n- [Phalcon = 5.x.x](https://phalconphp.com/fr/download)\n- php = 8.x.x\n\nUsing Composer:\n\n```json\n{\n    \"require\": {\n        \"v-cult/phalcon\": \"dev-master\"\n    }\n}\n```\n\nCreate a Phalcon symlink to application.php in your root project folder:\n\n```bash\ncd /var/www/project/\nln -s vendor/v-cult/phalcon/application.php ./phalcon\n```\n\nOr in /usr/bin to be used globally:\n\n```bash\nsudo ln -s /var/www/project/vendor/v-cult/phalcon/application.php /usr/bin/phalcon\n```\n\n## Quick start\n\nFor all commands, you can specify the environment and application with options `--env=` and `--app=`.  \nThe default values are dev/frontend. You can add any -- option; it will be available as a define in the task.\n\n### Create project\n\n```bash\n./phalcon generate:project\n```\n\nThis command will create the `apps` and `public` directories in the root project folder, initialized with the frontend application.  \nThe document root of the server must be the `public` directory, referring to the [readme.md](https://github.com/corentin-begne/phalconTool/blob/master/templates/project/README.md) file added in the project.  \nBy default, the `api` and `scrud` libraries are not enabled.  \nYou can also create any another app like `backend` for example.\n\n```bash\n./phalcon generate:app backend\n```\n\nIf you don't need User management, remove `beforeDispatch` from security in `services.php`.\n\n### Generate models\n\nBefore generating models, don't forget to modify the `config.php` file in your app folder.  \nOn generation, if the database is empty, it will import `defaultModels.sql` from the `templates` folder.\n\n```bash\n./phalcon models:generate\n```\n\nModels will be created from the database with column mapping and all relations.  \nBy default, SCRUD is not activated.  \nYou need to add `api` and `scrud` in the `config.php` file inside the `libraries` array, uncomment path in `SecurityPlugin` to add them in components and add them to the private or public resources.  \nYou are now able to access SCRUD actions for all models.  \nFor example, for User:\n\n```text\nhttps//localhost/frontend/scrud/User/read?id=1\nhttps//localhost/frontend/scrud/User/create\nhttps//localhost/frontend/scrud/User/search\n```\n\nYou can merge all models that have a `hasOne` relation.  \nFor example, if you add the UserProfil table, you can access it like this:\n\n```text\nhttps//localhost/frontend/scrud/User UserProfil/read?id=1\nhttps//localhost/frontend/scrud/User UserProfil/create\nhttps//localhost/frontend/scrud/User UserProfil/search\n```\n\nThis way, you can set up models with `hasOne` relations.  \nIf you don't need User manager remove tables `User` and `PermissionType`.  \n\nYou can access to models listing:  \n\n```text\nhttps//localhost/frontend/scrud/\n```\n\n### Generate controllers and actions\n\nYou can specify one or more actions associated with the controller.  \nBy default, the views associated with the actions are created, but the option `--no_view=true` blocks this.\n\n```bash\n./phalcon generate:controller home index,test\n```\n\nThis command will create the `home` controller with the `index` and `test` actions, along with their views.\n\n### Generate forms\n\nYou can generate forms that contain all inputs corresponding to their model field types, param must be a model name.\n\n```bash\n./phalcon generate:form PermissionType\n```\n\n### Generate tasks\n\nSimilar to generating controllers, you can create tasks with multiple actions at once.\n\n```bash\n./phalcon generate:task video convert,purge\n```\n\nOnce created, these tasks can be accessed like any other task.\n\n```bash\n./phalcon video:purge\n```\n\n### Generate Sass and Js\n\nThe asset manager sets default collections for CSS and JS.  \nThere is a main CSS file that should be generated compiling Sass and two JS files (main and manager).  \nThe main file is the entry point for each collection.  \nThese collections are included in the default layout.  \nYou can generate these files for each controller/action, and for the index, it will be placed in the root folder.  \nYou can also generate global JS helpers.  \nUse an empty action for index.\n\n```bash\n./phalcon generate:scss home ,test\n./phalcon generate:js home ,test\n./phalcon generate:js helper form\n```\n\nYou can compile all Sass globally or for a specific controller/action, use empty action for index.  \nIf you specify the `prod` environment, the path will be modified by the first CDN configured, and the version will be updated from `config.php`.  \nJs gnerated are `ES6` modules, you can use importmap, you need to create a `importmap.json` inside the `public` folder, file is used on dev environment and to resolve paths on build.\n\n```bash\n./phalcon generate:sass\n./phalcon generate:sass home\n./phalcon generate:sass home ,test\n./phalcon generate:sass --env=prod\n```\n\n### Generate Js build\n\nYou can generate a JavaScript build file for each controller/action or globally, use emepty action for index.\n\n```bash\n./phalcon generate:build home ,test\n./phalcon generate:build home\n./phalcon generate:build\n```\n\nThis command will generate a `build.mjs` file in the action directory, which will be automatically used in the production environment.\n\n### Translation\n\nInside each view, you can use `$t-\u003e_`or `$t-\u003e__` to get translations from keys inside the array from the `messages` folder.  \nThe language used corresponds to the browser language, using `en` as the default.  \n`$t-\u003e_` is more specific and allows access to the translations within the controller/action context.  \nThe translation functions are accessible from the controller, so inside the action, use `$this-\u003e__` and `$this-\u003e_` to access to the translations.\n\n```php\n// View inside controller user action login\n$t-\u003e_('hi') // $messages['hi']\n$t-\u003e__('hi') // $messages['user_login_hi']\n```\n\nYou can use SCRUD to manage translations using the `LangMessage` default table or directly un files inside `messages` folder.  \nUse the task to import (files to database) or export (database to files) data:\n\n```bash\n./phalcon message:import\n./phalcon message:export\n```\n\n### Migration\n\nThe migration system is based on annotations and modifications made in the models.  \nIt reports the differences from the database.\n\n```bash\n./phalcon migration:generate\n```\n\nOnce generated, you can run the migration.\n\n```bash\n./phalcon migration:run\n```\n\nRunning this command will execute all the migrations from the current version (env_version inside `migrations` folder) to the last one.  \nYou can also roll back one migration at a time.\n\n```bash\n./phalcon migration:rollback\n```\n\nOr roll back until a specific version.\n\n```bash\n./phalcon migration:rollback 1\n```\n\nYou can also create a model template.\n\n```bash\n./phalcon generate:model test\n```\n\n### Data Export\n\nRun this command to export tables from the database.  \nIf you leave the parameter empty, all tables will be exported.  \nTables will be exported as CSV files in the `dumps` folder.\n\n```bash\n./phalcon data:export User\n```\n\n### Data Import\n\nAll CSV files in the `dumps` folder will be imported. Add the `truncate` option to truncate tables before importing.  \nOtherwise, it will perform a replace based on the primary key.\n\n```bash\n./phalcon data:import --truncate\n```\n\n### CDN\n\nYou can configure CDN URLs in the `config.php` file.  \nTypically, CDN URLs are only used for the production environment.  \nIf you don't need or want to remove this functionality in the services.php file, leave an empty folder.\n\n### Make a release and send to env server\n\nThere's a task made for this purpose, you just need to specify the environment.  \nYou can configure it in the `config.php` file by setting the private key, args, excludes, login, and server.  \nIn the preprod and prod environment, it will compile Sass and build JS before sending the files using rsync.\n\n```bash\n./phalcon release --env=prod\n```\n\n### Libraries\n\nYou can add your own libraries by placing them inside the `libraries` folder.  \nLibraries can include controllers, config files (loader, router), views (layouts, partials, views), and public data.  \nOnce added, simply include them in the `config.php` file within the `libraries` array.\n\n### CLI\n\nThe CLI (Command Line Interface) has default services with MySQL, but you can define your own by creating a file named `services_cli.php` inside the `config` folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentin-begne%2FphalconTool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorentin-begne%2FphalconTool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentin-begne%2FphalconTool/lists"}