This project is based on the official Craft 3 starter project
- Environment Considerations
- New Project Setup
- Miscellaneous Information
- Project Specific Information
- About Craft CMS
Run: $ xcode-select --install
and follow the instructions. It can take a few minutes to install.
You can download MAMP here and find the installation instructions here.
CraftCMS v3 now uses PHP Composer to manage Craft updates, plugins, and other things related to CraftCMS. While there are installation instructions for various operating systems, we have found that the most common setup (i.e. MacOSX and Ubuntu Linux) can be installed by doing the following:
- Ensure that you have PHP installed
- Download and save the Composer installer here: https://getcomposer.org/installer
- Open a terminal and go to the directory in which you saved the Composer installer.
- Run the following command from the terminal in order to install Composer globally (assuming the file you downloaded and saved is named "installer":
$ php installer --install-dir=/usr/local/bin --filename=composer
- Run
$ composer --version
to verify that the installation was successful.
If all goes well and you were able to install Composer globally, then this is the only time you will have to install Composer.
CraftCMS v3 projects based on craft-boilerplate
utilize nodejs
, npm
, and laravel mix
, in order to run SASS processing, javascript minifcation, and autoprefixing.
Find out how to download and install node
for your environment here (which includes npm
): https://nodejs.org/en/download/
Follow these instructions when you need to start a brand new CraftCMS from scratch, utilizing this bootstrap project as a foundation and a starting point.
- Ensure that you have installed all required software - see Environment Considerations
- Download the latest archive master version of the craft-boilerplate project, found here
- Create a new directory for the new project and unzip the craft-boilerplate archive into this directory.
- Open up a terminal and change the directory where you unzipped the archive above.
- Run
$ composer install --no-scripts
, which will download Craft and all associated plugins. - Run
$ composer run-script post-create-project-cmd
, which will guide you through the "CraftCMS Initialization" steps that ultimately create an .env file and set your security key. - Add a new site/database to MAMP and make sure a database is available for Craft to be installed into.
- MAMP users need to make sure and uncomment a line in the
.env
forBACKUP_COMMAND
,RESTORE_COMMAND
, andDB_SOCKET
- Run
$ ./craft setup
and follow the instructions, which will fill out the rest of the fields in your .env file and set up the database for first-time use. - Run
$ npm install
, which will install all Node dependencies for this project. - Access your control panel at
/admin
and login using the credentials you created during installation. Browse to Settings -> Plugins, and install each of the plugins listed.
This CraftCMS project expects certain files to be in specific locations in order to be used.
- assets/ - Parent directory where javascripts/sass files are stored
- assets/javascript/ - Your project's javascript files go here.
- assets/sass/ - Your project's SASS files go here (Tailwind CSS by default).
- config/ - Parent directory which holds configuration files
- config/db.php - Database configuration, but mostly pulled from
.env
- config/general.php - General CraftCMS configuration file
- config/license.key - License key that gets generated upon site bootstrap.
- config/project.yaml - Project Config settings to help sync your fields/sections/settings across environments.
- config/db.php - Database configuration, but mostly pulled from
- modules/ - Holds any custom Yii modules you might be using
- public/ - Project's site root according to your webserver
- public/images/ - Project's non-asset images are stored here (git controlled)
- public/index.php - Root PHP file read by the webserver
- public/uploads/ - Parent directory for all uploaded assets (not git controlled)
- public/assets/ - Compiled assets (js/sass/etc) get put here (not git controlled)
- scripts/ - Utility shell scripts to perform various functions
- storage/ - CraftCMS dynamically generated files, such as logs and backups.
- templates/ - The location for all Twig templates
- .env.example - Example
.env
file - composer.json - PHP Composer configuration file
- composer.lock - PHP Composer package information lock file
- craft - CraftCMS PHP console application
- craft.bat - CraftCMS console loader for Windows
- favicon.js - Automated utility for saving favicon and other files like that
- tailwind.config.js - Tailwind css configuration
- webpack.mix.js - Laravel Mix configuration (sass/js compilation, etc)
- package.json - npm packages configuration file
- package-lock.json - npm packages information lock file
More detailed information about the default structure can be found here: https://docs.craftcms.com/v3/directory-structure.html
- Database and environment name are set in the .env file when you craft setup
- This file is not tracked in git, helping to keep passwords more secure
- My development environment is setup using apache which I find a tad simpler to work with locally
- Refer to this repo if the staging/prod environment is not using our setup scripts
- It may be a little heavy handed so an alternative with the least amount of required bits is here
- Laravel Mix makes webpack implementation very easy and has a fairly basic setup for Sass and JS merging
- No database is included.
- Add a blank database to your local host and then fill in the details of that when running
./craft setup
- Go to yourdomain.test/admin and craft will install a new version into that empty database
- Tailwind CSS is included in the project
- Use these scripts to pull down db and assets
- Change the settings in the
/scripts/.env.sh
file to match your local machine and the remote server
Craft is a flexible, user-friendly CMS for creating custom digital experiences on the web and beyond.
It features:
- An intuitive, user-friendly control panel for content creation and administrative tasks.
- A clean-slate approach to content modeling that doesn’t make any assumptions about the content you need to manage.
- A fast and flexible templating system based on Twig.
- An auto-generated GraphQL API for building headless applications.
- A powerful ecommerce platform for building bespoke ecommerce experiences.
- A built-in Plugin Store with hundreds of free and commercial plugins.
- A robust extension framework for advanced customization.
- An active, vibrant community.
You can learn more about it at craftcms.com, or dive into the documentation at craftcms.com/docs.
Craft is a self-hosted PHP application. It can connect to MySQL and PostgreSQL for content storage. See Server Requirements for more details.
- Website — Welcome to Craft!
- Tutorial — Build a blog with step-by-step instructions.
- Installation — Jump right in with Composer.
- Documentation — Read the official docs.
- Knowledge Base — Find answers to common problems.
- Newsletter — Get official news and community updates.
- Dot All — Attend our annual conference.
- #craftcms — See the latest tweets about Craft.
- Discord — Meet the community.
- Stack Exchange — Get help and help others.
- CraftQuest — Watch unlimited video lessons and courses.
- nystudio107 Blog — Learn Craft and modern web development.