curl -sSL https://raw.githubusercontent.com/doubleleft/hook/master/scripts/install.sh | bash
Local development server
To run a local development server,
cd into hook directory, then run the
$ cd ~/Projects/hook $ hook server ... PHP 5.4.33 Development Server started at Sat Apr 11 18:51:47 2015 Listening on http://0.0.0.0:4665 Document root is /Users/endel/Projects/hook/public Press Ctrl-C to quit.
The default endpoint for local development server is http://0.0.0.0:4665.
Creating a new application
The first step to develop application with hook, is to create a new application in the server.
Deploying your application
deploy command will upload all your application modifications inside
hook-ext directory, such as modules (observers, routes, templates and
channels), configurations (config.yaml, security.yaml, schema.yaml), packages
(packages.yaml) and schedule (schedule.yaml).
hook deploy ... Successfully deployed.
Every change you make inside
hook-ext directory needs to be deployed to
affect the backend.
Collection seeding is a way to define some initial contents for your
application's collections, such as categories, tags, etc. In this example we'll
generate some dummy content for a collection called
To generate the seed file for the collection you need, run the following command:
hook generate:seed events Seed created at 'hook-ext/seeds/events.yaml'.
You can now edit the
hook-ext/seeds/events.yaml file that was generated to
add your entries.
# # Seed for events # truncate: true data: - name: My first event picture: !upload path/to/picture.jpg - name: My second event picture: !upload path/to/picture-2.jpg
Things to note here:
- You may upload files by using
- By using
truncate: trueinstruction, the collection will be entirely cleared before being seeded again.
After you're done, let's seed the events collection with the following command:
hook db:seed events
If you have more than one seed file, you may seed all of them once by running:
Be careful to not truncate collections with user generated content.
It is designed for testing and debugging your application code and evaluating state.
$ hook console
The console can be closed by pressing
hook. Unlike the browser environment, every time the client tries to return a Promise, it will immediatelly be evaluated and its output will formatted and displayed.
generate:channel - Generate custom channel class.
hook generate:channel <channel-name>
generate:observer - Generate observer class for collection events.
hook generate:observer <collection-name>
generate:route - Generate a custom route for the application.
hook generate:route <path> [method=GET]
generate:schema - Generate schema definition config.
generate:seed - Generate seed template.
hook generate:seed <collection-name>
generate:template - Generate an HTML template.
hook generate:template <template-name>
Retrieving application data
keys: List all application keys.
logs: Get app back-end logs.
You may specify the number of lines you want to return from logs with
modules: List all application modules
schedule: List tasks scheduled for app.