Installing Laravel Nova From a Private Repository

Jim Wright
3 min readAug 22, 2018

--

Note: while you can still use the methods in this article for your own purposes, Laravel Nova now allows you to install from their private Satis repository… https://nova.laravel.com/docs/1.0/installation.html#installing-nova-via-composer

Laravel Nova looks like an excellent tool for quickly building a full featured admin interface for your existing Laravel application. When following the instructions for installation that are on the Nova website, some users may balk at adding the code to the root of their project and then having composer pull the package from there. You might want to have the versions of Nova that you are using under source control, but perhaps not within your project (when I put that directory in my project, there were 578 new files to commit). You also might want to keep a central source for Nova if you are using it across multiple applications or sites. In this article I’ll detail how I installed Nova within an application using a copy hosted in a private Bitbucket repository, and hopefully this will be useful to someone.

Here are the steps to make this work (this assumes that you have the appropriate Nova license purchased and a git client installed and configured):

  • Download the latest Nova zip file from the Nova website and extract it somewhere on your computer.
  • Create a new private repository at your git host of choice (Bitbucket in my case..and I went out on a limb and named the repository “nova”)
  • Go to where you extracted the Nova code on your computer at a command line and enter the following commands. The remote command will vary based on your particular environment. I’m using the Nova version that I just downloaded for the commit message.
git init
git add .
git commit -am "Version 1.0.0"
git tag v1.0.0
git remote add origin git@bitbucket.org:yourusername/nova.git
git push origin master --tags
  • Now edit the composer.json file in your existing Laravel application that you are hoping to supercharge with Nova. Add the following in the appropriate places:
"require": {
...
"laravel/nova": "^1.0.0"
},
"repositories": [
{
"type": "vcs",
"url": "yourusername@bitbucket.org:yourusername/nova.git"
}
]
  • Run composer update and it should pull Nova from this new repository.
  • Now you should be able to return to the official Nova docs and continue the installation as described.

If the above doesn’t work for you, it might be something with how composer is trying to pull from your vcs. Check out this link.

Of course, with this method updating the code when new Nova releases come out won’t be quite as simple as if you had put it in the root of your project. Here are some steps you can follow for that:

  • Download the new version of Nova and extract it.
  • Delete all of the contents of the git tracked Nova directory (excluding the .git folder, though if it is hidden you likely won’t be deleting it anyway)
  • Copy the contents of the newly downloaded directory to your git tracked directory.
  • Run the following at the command line in the root of the git tracked directory:
git add .
git commit -m "Version 1.0.3"
git tag v1.0.3
git push origin master --tags

If everything worked as it should, you should now have pushed only the changes to the newest version of Nova to your git repository. If you do a composer update, it should see that there is a new version and update your project.

Anyway, I hope this helps someone…and that it is even a good idea! If you have any ideas on how this can be improved or possible gotchas, as I haven’t installed a composer dependency through this method previously, please let me know.

-Jim

--

--