diff --git a/docs/extensions/composer.md b/docs/extensions/composer.md index 435907ec..c6474f85 100644 --- a/docs/extensions/composer.md +++ b/docs/extensions/composer.md @@ -1,4 +1,52 @@ Using Composer Packages ======================= -[todo] Using Composer packages: This might be evident, but we should write a paragraph or two about it nonetheless. \ No newline at end of file +By default, after installing Bolt you will get two composer files: `composer.json` +and `composer.lock`. Those files are there to manage the dependencies of your +project. Dependencies are third-party libraries that your code needs for it to +execute correctly. + +For example, in the `composer.json` file in your project, you'll see something like this: + +```json +"require": { + "php": ">=7.2.9 || ^8.0", + "bolt/core": "^5.0" + "bolt/assets": "^5.0", +} +``` + +As the key of each dependency in `require` you'll find the name of the dependency, +like `php` and, yes, `bolt/core`. The value specifies the version constraints, i.e. +the versions of the third-party packages that your code is compatible with. `^5.0` means any version that is `5.0` +or higher, but lower than `6.0`. + +### Managing dependencies + +You can install packages using `composer require`, for example: + +``` +composer require bolt/forms +``` + +To remove: + +``` +composer remove bolt/forms +``` + +To update a specific package +``` +composer update bolt/forms +``` + +To update all packages +``` +composer update +``` + +The above commands will update *both* `composer.json` and `composer.lock`. Simply put, `composer.json` keeps the +configuration and version constraints of your project. `composer.lock` keeps the exact versions of all packages +that you got with the most recent update command. + +For more details, check [semantic versioning](https://semver.org/) and the [Packagist repository](https://packagist.org/). diff --git a/docs/extensions/entities.md b/docs/extensions/entities.md index 290c68e4..41924ba1 100644 --- a/docs/extensions/entities.md +++ b/docs/extensions/entities.md @@ -3,6 +3,113 @@ Doctrine Entities (managing content) Read more about this topic in Doctrine's official documentation: [Doctrine ORM][docs]. -[todo] +## What are Entities? -[docs]: https://www.doctrine-project.org/projects/orm.html \ No newline at end of file +Entities are, simply put, PHP objects that allow CRUD (create-read-udpate-delete) operations +with the database. + +Thinking of traditional SQL databases, you can think of an Entity as a row in a table in the database. + +The entity class serves two purposes: + +1. Define the columns and properties of the table in the database (i.e., what fields does it store) +2. An a PHP object, store the data for a specific instance (row) + +For example, a very basic entity can be defined as a `Product`: + +```php +