composer / packagist

Package Repository Website - try https://packagist.com if you need your own -
https://packagist.org/
MIT License
1.75k stars 477 forks source link
packagist php

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

Installation

  1. Clone the repository

  2. 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 and APP_DEV_EMAIL_RECIPIENT in .env.local. Set also MAILER_DSN if you'd like to receive email.

  3. Start the web server:

    symfony serve -d
  4. 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.

  5. Create 2 databases:

    • packagist - for the web app
    • packagist_test - for running the tests
      bin/console doctrine:database:create
      bin/console doctrine:database:create --env=test
  6. Setup the database schema:

    bin/console doctrine:schema:create
  7. Run a CRON job bin/console packagist:run-workers to make sure packages update.

  8. Run npm run build or npm run dev to build (or build&watch) css/js files. When using Docker run docker 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