packagist
Package Repository Website - try https://packagist.com if you need your own -
Top Related Projects
A static analysis tool for finding errors in PHP applications
PHP Static Analysis Tool - discover bugs in your code without running it!
PHP Mutation Testing library
🔰 Instant PHP quality checks from your console
Quick Overview
Composer/Packagist is the main repository for the Packagist website, which serves as the primary PHP package repository. It allows PHP developers to discover, share, and manage dependencies for their projects using Composer, a dependency management tool for PHP.
Pros
- Centralized repository for PHP packages, making it easy to find and use libraries
- Integrates seamlessly with Composer, simplifying dependency management
- Provides detailed package information, including version history and dependencies
- Offers a user-friendly web interface for package discovery and management
Cons
- Can be slow to update package information during peak times
- Relies on package maintainers to keep their information up-to-date
- Limited control over package quality and security
- Occasional downtime can affect project builds and deployments
Code Examples
This project is not a code library, so code examples are not applicable.
Getting Started
As this is not a code library, there are no specific getting started instructions. However, to use Packagist in your PHP projects:
- Install Composer: https://getcomposer.org/download/
- Create a
composer.json
file in your project root:
{
"require": {
"vendor/package": "^1.0"
}
}
- Run
composer install
to install dependencies - Use the installed packages in your PHP code
For more information on using Composer and Packagist, visit: https://getcomposer.org/doc/
Competitor Comparisons
A static analysis tool for finding errors in PHP applications
Pros of Psalm
- Focuses on static analysis and type checking for PHP, enhancing code quality and catching potential errors
- Provides more detailed and customizable analysis options for PHP codebases
- Offers a wider range of plugins and extensions for additional functionality
Cons of Psalm
- More complex setup and configuration compared to Packagist's straightforward package management
- Requires more time and resources to run analysis, especially on larger projects
- May produce false positives or require additional annotations in some cases
Code Comparison
Psalm (type checking):
<?php
function example(string $input): int {
return strlen($input);
}
Packagist (package definition):
{
"name": "vendor/package",
"require": {
"php": "^7.4 || ^8.0"
}
}
Summary
Psalm is a powerful static analysis tool for PHP, offering in-depth code analysis and type checking. It excels in identifying potential errors and improving code quality but requires more setup and resources. Packagist, on the other hand, focuses on package management and distribution, providing a simpler interface for managing dependencies in PHP projects. While both tools serve different purposes, they can be used together to enhance PHP development workflows.
PHP Static Analysis Tool - discover bugs in your code without running it!
Pros of PHPStan
- Focuses on static analysis, providing deep code inspection and error detection
- Offers customizable rule sets and configuration options
- Integrates well with CI/CD pipelines for automated code quality checks
Cons of PHPStan
- Limited to PHP language analysis, unlike Packagist's broader package management
- Steeper learning curve for configuring and interpreting results
- May produce false positives in complex codebases
Code Comparison
PHPStan (static analysis):
<?php
function foo(int $a, int $b): int {
return $a + $b;
}
foo('1', 2);
Packagist (package management):
{
"require": {
"phpstan/phpstan": "^1.10"
}
}
While PHPStan focuses on code analysis and error detection, Packagist is primarily used for package management and dependency resolution in PHP projects. PHPStan excels at identifying potential issues in PHP code, such as type mismatches or undefined variables, whereas Packagist facilitates the installation and management of PHP libraries and frameworks.
PHPStan is more specialized and targeted towards improving code quality, while Packagist serves as a central repository and distribution system for PHP packages. Both tools are valuable in the PHP ecosystem, but they serve different purposes and are often used together in modern PHP development workflows.
PHP Mutation Testing library
Pros of Infection
- Focuses on mutation testing, providing a unique tool for improving test quality
- Offers detailed reports on mutants and test coverage
- Integrates well with existing PHP testing frameworks
Cons of Infection
- More specialized tool with a narrower use case
- Requires existing test suite to be effective
- Can be resource-intensive for large codebases
Code Comparison
Infection (mutation testing):
$mutator = new PlusEqualsMutator();
$mutation = $mutator->mutate($node, $this->parser, $this->printer);
Packagist (package management):
$packages = $this->packagist->search($query, $filters, $page);
$result = $this->createResult($packages, $total);
Summary
Infection is a mutation testing framework for PHP, while Packagist is the main Composer repository. Infection helps developers improve their test suites by introducing bugs (mutations) and checking if tests catch them. Packagist, on the other hand, serves as a central repository for PHP packages, enabling easy dependency management.
While both tools are valuable for PHP developers, they serve different purposes. Infection is more specialized, focusing on test quality, while Packagist has a broader application in managing project dependencies. The choice between them depends on the specific needs of a project or development workflow.
🔰 Instant PHP quality checks from your console
Pros of PHPInsights
- Focuses on code quality analysis and provides detailed insights
- Offers a user-friendly CLI interface with colorful output
- Provides customizable rulesets and configuration options
Cons of PHPInsights
- Limited to PHP projects, while Packagist supports multiple languages
- Smaller community and ecosystem compared to Packagist
- Requires more setup and configuration for optimal use
Code Comparison
PHPInsights:
use NunoMaduro\PhpInsights\Application;
$application = new Application();
$results = $application->analyse(__DIR__);
Packagist:
use Composer\Factory;
use Composer\IO\NullIO;
$composer = Factory::create(new NullIO());
$packages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
Summary
PHPInsights is a specialized tool for PHP code quality analysis, offering detailed insights and customizable rulesets. It provides a user-friendly CLI interface but has a smaller ecosystem compared to Packagist. Packagist, on the other hand, is a more comprehensive package manager for PHP projects, supporting a wider range of languages and having a larger community. While PHPInsights focuses on code analysis, Packagist handles dependency management and package distribution.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Packagist
Package Repository Website for Composer, see the about page on packagist.org for more.
This project is not meant for re-use.
It is open source to make it easy to contribute. We provide no support if you want to run your own, and will do breaking changes without notice.
Check out Private Packagist if you want to host your own packages.
Development
These steps are provided for development purposes only.
Requirements
- PHP for the web app
- NPM (or Docker) for the frontend build
- Symfony CLI to run the web server
- MySQL (or Docker) for the main data store
- Redis (or Docker) for some functionality (favorites, download statistics)
- git / svn / hg depending on which repositories you want to support
Installation
-
Clone the repository
-
Install dependencies:
composer install npm install
Ensure env vars are set up correctly, you probably need to set
APP_MAILER_FROM_EMAIL
,APP_MAILER_FROM_NAME
andAPP_DEV_EMAIL_RECIPIENT
in.env.local
. Set alsoMAILER_DSN
if you'd like to receive email. -
Start the web server:
symfony serve -d
-
Start MySQL & Redis:
docker compose up -d # or somehow run MySQL & Redis on localhost without Docker
This mounts the current working directory into the node container and runs npm install and npm run build automatically.
-
Create 2 databases:
packagist
- for the web apppackagist_test
- for running the tests
bin/console doctrine:database:create bin/console doctrine:database:create --env=test
-
Setup the database schema:
bin/console doctrine:schema:create
-
Run a CRON job
bin/console packagist:run-workers
to make sure packages update. -
Run
npm run build
ornpm run dev
to build (or build&watch) css/js files. When using Docker rundocker compose run node npm run dev
to watch css/js files.
You should now be able to access the site, create a user, etc.
Fixtures
You can get test data by running the fixtures:
bin/console doctrine:fixtures:load --group base
bin/console doctrine:fixtures:load --group downloads --append
This will create some packages, update them from GitHub, populate them
with fake download stats, and assign a user named dev
(with password: dev
)
as their maintainer.
There is also a user user
(with password: user
) that has no access if you
need to check readonly views.
Finally there is a user admin
(with password: admin
) that has super admin
permissions.
Search
To use the search in your local development environment, setup an
Algolia Account and configure following keys
in your .env.local
:
ALGOLIA_APP_ID=
ALGOLIA_ADMIN_KEY=
ALGOLIA_SEARCH_KEY=
ALGOLIA_INDEX_NAME=
To setup the search index, run:
bin/console algolia:configure
bin/console packagist:index
Top Related Projects
A static analysis tool for finding errors in PHP applications
PHP Static Analysis Tool - discover bugs in your code without running it!
PHP Mutation Testing library
🔰 Instant PHP quality checks from your console
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot