A modern, lightweight Content Management System (CMS) built with PHP and JavaScript, designed for flexibility and ease of use. This CMS leverages an MVC architecture, utilizing PHP libraries like Laravel's Eloquent ORM, Twig templating, and a simple router, combined with a robust front-end setup using Webpack, Bootstrap, and jQuery.
- MVC Architecture: Organized structure with Core and App namespaces for clean code separation.
- Database Support: Uses Laravel's Eloquent ORM (
illuminate/database) for database interactions. - Templating: Powered by Twig (
twig/twig) for dynamic and secure template rendering. - Routing: Simple and fast routing with
pecee/simple-router. - Front-End: Built with Bootstrap 5, jQuery, and Webpack for modern, responsive UI.
- Additional Tools:
- PDF generation with
mpdf/mpdf. - Image processing with
spatie/image. - JWT authentication with
firebase/php-jwt. - Environment configuration with
vlucas/phpdotenv.
- PDF generation with
- Development Tools: Includes GrumPHP for code quality and Webpack for asset bundling.
Before setting up the project, ensure you have the following installed:
- PHP: 8.1 or higher
- Composer: For PHP dependency management
- Node.js: 16.x or higher
- npm: For JavaScript dependency management
- MySQL: For database storage
- Git: For cloning the repository
Follow these steps to set up the CMS locally:
-
Clone the Repository:
git clone https://github.com/gmaxsoft/cms.git cd cms -
Install PHP Dependencies: Run the following command to install the required PHP packages:
composer install
-
Install JavaScript Dependencies: Install front-end dependencies using npm:
npm install
-
Set Up Environment: Copy the
.env.examplefile (if available) to.envand configure your environment variables:cp .env.example .env
Update the
.envfile with your database credentials and other settings. Example configuration:DEBUG=true DEFAULT_BLOCK_LANG=1 DB_DRIVER=mysql DB_HOST=localhost DB_NAME=YOUR OWN DATABASE NAME DB_USER=root DB_PASS= FRONTEND_URL=http://localhost:3000 SECRET_KEY=your-secure-secret-key DEFAULT_BLOCK_LANG = 1 SLIDERFILESPATH = 'upload/sliderImg/'
-
Set Up the Database: Create a MySQL database named
YOUR OWN DATABASE NAME(or your preferred name, matching theDB_NAMEin.env). To start the database installation process, enterhttp://localhost:3000/install.php. Follow the instructions. -
Build Front-End Assets: Compile and bundle the front-end assets using Webpack:
npm run build
-
Start the Development Server: Start the Webpack development server for front-end development:
npm run dev
Alternatively, serve the PHP application using a local server (e.g., PHP's built-in server):
php -S localhost:8000 -t public
-
Access the CMS: Open your browser and navigate to
http://localhost:3000for the front-end orhttp://localhost:8000for the PHP server, depending on your setup.
- Admin Panel: Access the CMS admin panel (if implemented) via the configured
FRONTEND_URL. - Customizing Templates: Modify Twig templates in the
app/viewsdirectory (assumed based on standard MVC structure). - Adding Routes: Define custom routes in the
appdirectory usingpecee/simple-router. - Asset Management: Update SCSS files in
public/scssor JavaScript files inpublic/jsand rebuild assets withnpm run build.
cms/
├── app/ # Application logic (Controllers, Models, etc.)
├── core/ # Core CMS functionality
├── public/ # Publicly accessible files
│ ├── js/ # JavaScript source files
│ ├── scss/ # SCSS source files
├── dist/ # Compiled front-end assets
├── vendor/ # Composer dependencies
├── node_modules/ # npm dependencies
├── .env # Environment configuration
├── composer.json # PHP dependencies
├── package.json # JavaScript dependencies
├── webpack.config.js # Webpack configuration
└── README.md # Project documentation
- Code Quality: Use GrumPHP for automated code quality checks:
composer run-script grumphp
- Front-End Development: Run
npm run devfor live reloading during development. - Production Build: Generate optimized assets for production:
npm run build
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Make your changes and commit (
git commit -m 'Add your feature'). - Push to the branch (
git push origin feature/your-feature). - Open a pull request on GitHub.
Report bugs or suggest features via the GitHub Issues page.
This project is licensed under the ISC License. See the LICENSE file for details.
For questions or support, contact the author:
- Name: Maxsoft
- Email: [email protected]
- GitHub: gmaxsoft