Download the PHP package jalexmelendez/citadel-framework without Composer
On this page you can find all versions of the php package jalexmelendez/citadel-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jalexmelendez/citadel-framework
More information about jalexmelendez/citadel-framework
Files in jalexmelendez/citadel-framework
Package citadel-framework
Short Description A CoC & easy to deploy framework for building robust and realtime web applications / API's (REST/GraphQL) built on top of Symfony and Mercure.
License MIT
Informations about the package citadel-framework
Citadel Framework
A CoC & easy to deploy framework for building robust and realtime web applications / API's (REST/GraphQL) built on top of Symfony and Mercure.
Versions
- Pre-alpha: this version is currently under development, it is used on production in Rurusi and Cut developments.
Parts of the framework
This framework was visualized as an easy way to create a Monolithic application with all the features modern developers would want, feel free to use this to make in record time your MVP.
Admin panel
This framework comes with EasyAdmin, an advanced tool to create administration backends, this is accessible only to users who have the admin role.
Where to modify?
The route and roles configuration is located on config/packages/security.yaml
TailwindCSS and daisyUI as default CSS framework
TailwindCSS and daisyUI are installed in this distribution to speed up the process of creating interfaces, you can find the configuration on tailwind.config.js, postcss.config.js and webpack.config.js.
Frontend asset compiler (Webpack Encore)
Login and auth
Web application
The default credentials for login are email and password, the default user model has email and username enabled by default, to change the login dynamic by default you can alter this field with either username or email to allow users to login.
The default route for the login page is "/login", after succesful login, the users with admin roles "ROLE_SUPER_ADMIN" and "ROLE_ADMIN" will be redirected to the admin dashboard, the other roles are redirected to "/dashboard".
And to change the login routes you can alter this configuration:
You can find the Login controller on
REST Api and graphql WEB AUTHENTICATION REQUIRED TO ACCESS THE DOCS
By default and with scalability in mind the default auth mechanism is using JSON Web Token (JWT), which according to wikipedia and for simplicity's sake is a JSON-based open standard (RFC 7519) for creating access tokens that assert some number of claims.
First you will have to login on your app, then you can go to '/api' to read the openapi docs, to edit the configuration you can modify this parts of this files.
To authenticate using JWT, first you will have to get a token in '/api/authentication_token', submit a post request like this or use the OpenAPI section to generate it.
You can also modify the login documentation on src/OpenApi/JwtDecorator.php.
Web profiler
The Symfony's web profiler is enabled by default when the env is development.
REST API
if your app instance is running go to /api, only authenticated users can access the docs!.
GraphQL
If you use an integer to query the data it will throw an error, this is because API platform id's are represented as an IRI (Internationalized Resource Identifier), to query data, the url prefix for the IRI must always be "/api/{resource}/{id?}".
take for example this query to select the email and roles of a user, you can paste this query for you to test it! (after you created your account of course).
You can read more about it here!.
Template engine
By default Twig is included.
Realtime updates
API platform supports mercure, this enables you to make realtime API's.
Automatic forms creation
You can easily create forms with the included makerfile.
Roadmap
- Add commands to setup the application framework.
- Add a version that integrates OpenSwoole to make a high performace framework.
Getting Started
Everything has been pre-configured for you, so you don't have to do break your head doing it, we have included bob "the builder" cli tool as an abstraction layer on top of symfony as well as custom commands to execute batch commands.
Advanced ussage
For experienced developers who want to customize the framework feel free to read the docs on the tools used (go to built with).
Prerequisites
- PHP >= 8.1
- Composer
- npm
- MySQL/PostgresSQL driver or SQLITE
- Symfony cli (Optional)
- Docker (Optional)
- LAMP/WAMP dev server (Optional)
Installing
Citadel comes with a powerful command to generate all migrations and compile resources.
NOTE: We must have our database connection on our .env file set up.
Configuring yor database
To store sessions in redis and use MongoDB as well as advanced configuration click here
As previously discussed, one important aspect to take into account is the database you will be using, you can of course use non relational databases like MongoDB and redis, nonetheless the default configuration is for relational databases.
The default database is SQLITE, to start using your desired database driver you should modify first your driver for doctrine in your .env file:
Then before building your app, you need to add the configuration in the only migration your migrations folder, do this by commenting the database drivers you will not use and leave uncommented the one you are using.
Building using bob cli tool UNDER DEVELOPMENT, PLEASE RUN THE MANUAL INSTALLATION PROCESS
This framework comes with server database sessions for the web application and JWT auth for the REST API/GraphQL Api powered by Api platform, to build the app for development execute:
Building from scratch using Symfony
You can use bob to execute this commands, nonetheless, we will remove al the boilerplate and show you how to build by using makerbundle.
Install all the composer dependencies
Generate keys
App Secret
JWT keys
Generate the initial migration in the database
Build your assets
Create an admin user to access the admin dashboard
Citadel Commands
Along with all the MakerBundle Commands Listed here, we included some commands, and expect to add more in the future to reduce boilerplate.
Execute command
Commands
command | description |
---|---|
build:dev | builds the application for development. |
build:prod | builds the application for deployment. |
build:app-secret | creates a new APP_SECRET |
new:admin | generates a new user with admin role. |
serve | starts a minimal dev server. |
Development server
Symfony CLI server
If you have the Symfony CLI installed, you can run:
Citadel minimal local server
This minimal local server helps you to develop you app using a local server.
Running the tests
Please read this documentation
And coding style tests
We strongly recommend using PSR-4 and PSR-12 coding standards
Deployment
You can find a detailed documentation here.
On apache
Deploying to apache and shared hosting has been pre-configured, as you can see we have apache pack and .htaccess with the configuration on it on the project.
[Read more]()
Shared hosting
This project comes with all the configuration needed to deploy it on shared hosting, you just have to upload the project to your public_html file and don't forget to configure php version >= 8.1.
On NGINX
On Docker
On Swoole
Built With
- Symfony - Symfony is a set of reusable PHP components and a PHP framework for web projects.
- API Platform - API Platform is the most advanced API platform, in any framework or language.
- MakerBundle - Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
- EasyAdmin - Creates beautiful administration backends for your Symfony applications. It's free, fast and fully documented.
- NPM - JavaScript Package Manager, Registry & Website.
Complements
- Mercure - Mercure is an open protocol for real-time communications designed to be fast, reliable and battery-efficient.
Contributing
Reach to us via github for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
Pending, we are currently on our alpha version.
Authors
- Jose Alejandro Melendez G. - Software engineer/CEO Rurusi - Rurusi
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
This tools motivated the creation of this framework, check them out!
All versions of citadel-framework with dependencies
ext-ctype Version *
ext-iconv Version *
api-platform/core Version ^2.6
doctrine/annotations Version ^1.0
doctrine/doctrine-bundle Version ^2.7
doctrine/doctrine-migrations-bundle Version ^3.2
doctrine/orm Version ^2.12
easycorp/easyadmin-bundle Version ^4.2
lexik/jwt-authentication-bundle Version ^2.16
nelmio/cors-bundle Version ^2.2
phpdocumentor/reflection-docblock Version ^5.3
phpstan/phpdoc-parser Version ^1.6
sensio/framework-extra-bundle Version ^6.1
symfony/apache-pack Version ^1.0
symfony/asset Version 6.1.*
symfony/console Version 6.1.*
symfony/doctrine-messenger Version 6.1.*
symfony/dotenv Version 6.1.*
symfony/expression-language Version 6.1.*
symfony/flex Version ^2
symfony/form Version 6.1.*
symfony/framework-bundle Version 6.1.*
symfony/http-client Version 6.1.*
symfony/intl Version 6.1.*
symfony/mailer Version 6.1.*
symfony/mime Version 6.1.*
symfony/monolog-bundle Version ^3.0
symfony/notifier Version 6.1.*
symfony/process Version 6.1.*
symfony/property-access Version 6.1.*
symfony/property-info Version 6.1.*
symfony/proxy-manager-bridge Version 6.1.*
symfony/runtime Version 6.1.*
symfony/security-bundle Version 6.1.*
symfony/serializer Version 6.1.*
symfony/string Version 6.1.*
symfony/translation Version 6.1.*
symfony/twig-bundle Version 6.1.*
symfony/validator Version 6.1.*
symfony/web-link Version 6.1.*
symfony/webpack-encore-bundle Version ^1.12
symfony/yaml Version 6.1.*
twig/extra-bundle Version ^2.12|^3.0
twig/twig Version ^2.12|^3.0
webonyx/graphql-php Version ^14.11