It is possible to load sample data into CampaignChain, which eases the development process.
- Don’t use sample data in production environments, because they might be buggy or contain confidential data.
- All existing data in your CampaignChain might be wiped out. Make sure you backup your CampaignChain database if you are not sure whether the sample data you load is safe.
Sample data for CampaignChain are being made available as Composer packages and can be installed through Composer with a command such as:
$ composer require amce/mydata
If you installed CampaignChain through composer with the
option, these two default sample data packages are already available:
The default sample data leverages the
live development environment,
i.e. the various test accounts and instances CampaignChain, Inc. set up at
Twitter, Facebook, MailChimp, wordpress.amariki.com and other online channels.
Take a look at above packages if you’d like to create your own sample data. Some hints:
- The data is being stored as Fixtures.
- To have CampaignChain load your sample data, put a file
data.ymlinto your bundle located at
- It’s good practice to give the super user the user name
We recommend that you put all passwords, App keys, secrets, access tokens, token
secrets, refresh tokens and other security sensitive information into a
credentials.yml file. Reason being that you might want to share
the sample data with others, but not the related credentials.
The aforementioned default sample data packages ship with a template file for
credentials.yml.tpl. To create your own file, follow
- Register your CampaignChain instance as an app for the various Channels
credentials.yml, such as Twitter and Facebook. If you’ve never done that, go to http://hybridauth.sourceforge.net/userguide.html and click on a provider (e.g. Twitter). On the respective page, there’s a section called “Registering application”. Proceed as described there.
- Now connect a new Location in CampaignChain (e.g. a Twitter stream). When
done, look up the respective tokens in the database table
campaignchain_security_authentication_client_oauth_tokenand put them into
If you would like to retrieve a
credentials.yml file for the default
sample data packages that works out-of-the-box, check out how to apply for
access to the live development environment.
campaignchain.env is set to
then you will be able to load sample data into CampaignChain in its Graphical
User Interface or through a command.
To use the GUI, visit the page http://example.com/development/sample-data of your CampaignChain installation.
- Make sure you have a working
credentials.ymlfile - see above.
- Load the page http://example.com/development/sample-data of your CampaignChain installation.
- There, pick the package of choice in the field “Data file” and select
credentials.ymlas the Include File. Activate the checkbox “Drop tables?” to start with a clean slate.
- Click “Upload” and good luck :)
- Log into CampaignChain with user
test(unless otherwise specified by the package).
In addition to the user interface, you could also load sample data by using the command line. Issue the following command in the root of your CampaignChain installation to load the test data along with its credentials:
$ php app/console campaignchain:fixture vendor/amariki/data-test/Resources/data/campaignchain/data.yml vendor/amariki/secrets/credentials_test.yml
Should the sample data upload not work, you can try two things:
- Fix the sample data and reload the browser window where you tried to upload the sample data.
- If 1. does not work, install CampaignChain from scratch.