Setting up a
Satis Server
Follow along:
slides.com/philsown/satis-server
OR
Share your code as far and
wide as possible using
Composer, even if it means
setting up your own
Satis package server.
What We'll Cover
- Who Am I
- You Should Share Code
- Where To Share
- How to set up a Satis server
- Q & A
Who Are You?
Phillip Harrington
phillipharrington.com
You Should
Share Code
For Reals...
Sharing Code
Will Make...
- Your code better
- Your documentation better
- You a better programmer
- The world a better place
How Can I
Share My Code?
- Use Composer on your projects
- Share on GitHub or Packagist
- Set Up your own package server
Composer
Dependency manager for PHP
getcomposer.org
GitHub
Git Repository Website
github.com
Packagist
The PHP Package Archivist
packagist.org
Satis
Package Server for Composer
github.com/composer/satis
Reasons to Use Satis
-
Share with coworkers
- Proprietary code
- Convince managers & lawyers
"Talk is cheap. Show me the code."
-- Linus Torvalds
Live Example
Let's set-up a package server!
packages.weblacarte.com
Install Composer
Run at the command line
$ curl -sS https://getcomposer.org/installer | php
Install Satis Using Composer
Make a composer.json file
{
"require": {
"php": ">=5.3.2",
"composer/composer": "1.0.*@dev",
"composer/satis": "1.0.*@dev"
}
}
Compose!
$ php composer.phar install -o
An Example Package!
github.com/philsown/Example-Required-Package
Configure Satis
Make a satis.json file
{
"name": "WebLaCarte Package Server",
"homepage": "http://packages.weblacarte.com/",
"repositories": [
{
"type": "git",
"url": "git@github.com:philsown/Example-Required-Package.git"
}
],
"require-all": true
}
Run Satis
$ vendor/bin/satis build satis.json public
Let's Use
Our Spiffy New
Package Server
A Completely Different
Example Package!
github.com/philsown/Example-Package
Checkout As A Project
$ git clone git@github.com:philsown/Example-Package.git Example-Package
Add The Package Server
Modify composer.json
"repositories": [
{
"type": "composer",
"url": "http://packages.weblacarte.com/"
}
]
Require The Package
Still in composer.json
"require": {
"philsown/Example-Required-Package": "dev-master"
}
Compose!
... Again!
$ php composer.phar install -o
It kind of worked!
Local Packages
Back in satis.json, add the "archive" section
"archive": {
"directory": "dist",
"format": "tar",
"prefix-url": "http://packages.weblacarte.com"
}
Run Satis
... Again!
$ vendor/bin/satis build satis.json public
Uh Oh!
Add Some Security
Make an .htpasswd File
$ htpasswd -c .htpasswd composer
Lock Down the Directory
Make an .htaccess file
AuthType Basic
AuthName "Package Server"
AuthUserFile /path/to/.htpasswd
Require valid-user
Compose!
Back in your project...
This time, prefer-dist
$ php composer.phar install -o --prefer-dist
Composer Can Do
401 Authentication!
Other
Enhancements
- Replace templates
- Pretty Error Pages
Satis Server
Implementation
github.com/philsown/Satis-Server
Questions?
Thank
You!
Satis Server
By Phillip Harrington
Satis Server
How to setup a Satis Server with examples.
- 2,343