Mindoro State University Composer Lecture Notes PDF

Document Details

Mindoro State University

Lee-Mar M. Arcon

Tags

Composer PHP dependency management software development

Summary

These lecture notes from Mindoro State University cover the Composer dependency management tool for PHP projects. The notes discuss Composer features, including dependency management, autoloading, and versioning. They also explore Composer commands for managing packages and dependencies. The lecture notes are focused on the concepts for undergraduate programming students.

Full Transcript

Mindoro State University College of Computer Studies COMPOSER Prepared by: LEE-MAR M. ARCON Instructor I E-mail Address: [email protected] Mobile Number: +639511177784 Bachelor of Science in...

Mindoro State University College of Computer Studies COMPOSER Prepared by: LEE-MAR M. ARCON Instructor I E-mail Address: [email protected] Mobile Number: +639511177784 Bachelor of Science in ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 College of College of Computer Computer Learning Objectives Click to edit Studies Studies Master title style At the end of the lesson, the learners should be able to: Understand the purpose and significance of version control systems in software development. Learn about Git as a distributed version control system and GitHub as a popular platform for hosting Git repositories. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer Learning Objectives Click to edit Studies Studies Master title style At the end of the lesson, the learners should be able to: Familiarize yourself with common Git commands such as git init, git add, git commit, git pull, git push, and git status. Learn how to clone an existing Git repository from a remote source (e.g., GitHub) to your local machine. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER Click to edit Studies Studies Master title style Composer is a dependency management tool specifically designed for PHP. It streamlines the process of installing, updating, and managing libraries or packages within PHP projects. Unlike system-wide package managers, Composer manages dependencies on a per-project basis, allowing each project to have its own set of dependencies. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER FEATURES Click to edit Studies Studies Master title style  Dependency Management - Composer automatically resolves and installs dependencies for PHP projects, ensuring that all necessary packages are downloaded, and compatible versions are selected based on project requirements. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER FEATURES Click to edit Studies Studies Master title style  Automatic Loading with Autoloader - Composer provides an autoloader to automatically include and use installed packages in your project without manually writing require or include statements.  Package Discovery and Installation - With Packagist as the default repository, Composer allows you to discover, install, and update open-source packages for various PHP libraries and frameworks ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER FEATURES Click to edit Studies Studies Master title style  Semantic Versioning Compatibility - Composer uses semantic versioning to manage package versions, allowing you to specify version constraints like exact, minimum, or range of versions that fit your project's needs.  CLI Commands - Composer provides a range of CLI commands such as composer install, composer update, and composer require to manage packages, update dependencies, and install libraries with ease. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER FEATURES Click to edit Studies Studies Master title style  Development vs. Production Dependencies - Composer allows you to specify require for production dependencies and require-dev for development-only dependencies. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER.JSON Click to edit Studies Studies Master title style Composer.json file is a configuration file that defines the dependencies, project metadata, and various configurations for a PHP project managed by Composer. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER.LOCK Click to edit Studies Studies Master title style Composer.lock an essential part of managing dependencies in a Composer- based PHP project. It serves as a record of the exact versions of each dependency that were installed at the time composer install was last run. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer INCLUDING DEPENDENCIES Click to edit Studies Studies Master title style require - Lists the packages and their versions required for the project to run. require-dev - Specifies dependencies only needed for development and testing purposes. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer PACKAGE VERSIONING Click to edit Studies Studies Master title style Laravel 11.31.0  Major version - indicates that there are backward- incompatible changes.  Minor version - indicates the addition of new features that are backward-compatible with the previous version.  Patch version - indicates backward-compatible bug fixes. Typically used for resolving bugs, fixing security vulnerabilities, or making minor improvements that don’t change the existing functionality. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER VERSIONING Click to edit Studies Studies CONSTRAINTS Master title style Caret (^) - Allows updates that do not break compatibility. For instance, ^1.2 allows updates up to (but not including) 2.0. Tilde (~) - Allows updates within a specific version. For example, ~1.2.3 would allow updates up to but not including 1.3. Wildcard (*) - Broad version matching, e.g., 1.* matches any 1.x version. Exact Versions - Specify an exact version, like 1.2.3, to restrict updates. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER BASIC COMMANDS Click to edit Studies Studies Master title style  composer install - Installs all packages listed in composer.json.  composer update - Updates all packages to the latest version according to the constraints in composer.json.  composer require - Installs a specific package and updates composer.json.  composer remove - Uninstalls a package and removes it from composer.json. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER College of College of Computer Computer COMPOSER ADVANCE COMMAND Click to edit Studies Studies Master title style  composer dump-autoload: Regenerates the autoload files, useful if you add custom classes.  composer show - Lists all installed packages.  composer outdated - Shows packages that have newer versions available.  composer validate - Checks composer.json for errors. ITE 413 : INTEGRATIVE PROGRAMMING AND TECHNOLOGIES 2 TOPIC: COMPOSER

Use Quizgecko on...
Browser
Browser